Forum Moderators: phranque

Message Too Old, No Replies

Rewrite http to https produces 400 error

         

zeebster24

7:46 pm on Jun 8, 2005 (gmt 0)

10+ Year Member



Hi everyone,
I hope there is someone that can help me on this since so far my google searches have been in vain.

I am trying to redirect all traffic on my web server to https using a rewrite rule (I am using one of many examples that I have seen out there. Here is the section in my httpd.conf

RewriteEngine on
RewriteCond %{SERVER_PORT}!^443$
RewriteRule ^/svn(.*)$ [%{SERVER_NAME}...] [L,R]

hitting http://server.example.com/svn/whatever in the browser however returns Error 400: Bad Request

looking at the error_log with loglevel set to debug I see this:
[Wed Jun 08 13:23:27 2005] [info] SSL handshake failed: HTTP spoken on HTTPS port; trying to send HTML error page
[Wed Jun 08 13:23:27 2005] [info] SSL Library Error: 336027804 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request speaking HTTP to HTTPS port!?

going to [server.example.com...] works just fine however.

I am sure it is something stupid that I am missing but can't seem to see what.

[edited by: jdMorgan at 8:17 pm (utc) on June 8, 2005]
[edit reason] Examplified. [/edit]

jdMorgan

8:15 pm on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



zeebster24,

Welcome to WebmasterWorld!

Have you tried a simple rewrite to be sure that mod_rewrite is working at all? Something like:


RewriteRule ^/foo\.html$ /some_page_that_exists.html [L]

Also, I assume you're putting this code in httpd.conf and not in .htaccess?

Jim

zeebster24

9:17 pm on Jun 8, 2005 (gmt 0)

10+ Year Member



Indeed, I just tested and I get this same error no matter what page I visit on http, even with all the Rewite lines removed.

https still works. I am not sure what I have done to mess up my httpd.conf but I have a feeling it is in there somewhere.