From: Dr. Peter Poeml (poeml_at_suse.de)
Date: Thu May 19 2005 - 17:37:55 CEST
Date: Thu, 19 May 2005 17:37:55 +0200 From: "Dr. Peter Poeml" <poeml@suse.de> Message-ID: <20050519153755.GV30873@suse.de> Subject: Re: [suse-sles-e] Apache2 + mod_rewrite +https truble (maybe SLES9 bug?)
On Thu, May 19, 2005 at 10:13:27AM +0200, Paolo Basenghi wrote:
> I configured an Apache2 virtualhost listening on ports 80 and 443. It
> worked fine both http and https.
> Next step was configuring authomatic redirection with mod_rewrite from
> http to https in that vhost; so I added following lines to the
> <VirtualHost> section:
>
> RewriteEngine on
>
> RewriteCond %{HTTPS} =off
>
> RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [R,L]
Did you test the exact same configuration?
> but it didn't work! It should be noted that on a different system, with
> RedHat Linux, it work perfectly.
Which apache version on RedHat?
> So I activated rewrite log and noticed that the HTTPS environment
> variable was not instantiated in SuSE so the RewriteCond result always
> false and the RewriteRule do not execute.
> As stated in the Apache official mod_rewrite documentation:
> "HTTPS Will contain the text "on" if the connection is using SSL/TLS,
> or "off" otherwise. (This variable can be safely used regardless of
> whether mod_ssl is loaded)."
RewriteCond %{HTTPS} !=on
should work for you. (Actually this is what you really want, I assume.)
> So I think is a SuSE distribution mod_rewrite bug or compilation issue.
> Someone other hit this issue? There is a workaround?
Not sure if it is a bug.
Do you use any SSL at all? mod_ssl is loaded, I guess?
(see /etc/sysconfig/apache2:APACHE_MODULES)
Regards,
Peter
-- SUSE LINUX Products GmbH Thought is limitation. Research & Development Free your mind.
This archive was generated by hypermail 2.1.7 : Thu May 19 2005 - 17:38:08 CEST