httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Ruiz Molina <>
Subject [users@httpd] Problems with Rewrite and SSL
Date Tue, 20 May 2008 12:37:56 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body bgcolor="#ffffff" text="#000000">
I'm trying to rewrite a HTTP connection as HTTPS one, but because of
the number of configured virtual hosts, I'm getting problems... I
explain here:<br>
- my server has configured 4 virtual hosts: A, B, C and D<br>
- virtual host A has configured into HTTP default site (Debian Etch) a
HTTPS redirection and it works fine. If I connect to A:80, I get a
redirection to A.443 (ssl site) and it is OK.<br>
<blockquote>&lt;VirtualHost A:80&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServerName A<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteEngine On<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteLog /var/log/apache2/http_rewrite_log<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteLogLevel 9<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteCond %(SERVER_PORT)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteRule ^/(.*)
<a class="moz-txt-link-freetext"
 href="https://%">https://%</a>{SERVER_NAME}/$1 [L,R]<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ...<br>
- however, If I connect to B:443, C:443 or D:443, apache runs ssl and,
by default, I run virtual host *:443 and loads A:443. For avoid this,
I'm doing tests with following configurations:<br>
<blockquote>- I'm trying to configure a condition for doing HTTPS
rewrite or not (into ssl site):<br>
  <blockquote>&lt;VirtualHost *:443&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServerName A #(&lt;----look
at this)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteCond %(SERVER_NAME)
!A$&nbsp; #(in other words, if I'm trying
to connect with SSL support to a site with no SSL support)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteRule ^/(.*)
<a class="moz-txt-link-freetext"
 href="http://%">http://%</a>{SERVER_NAME}/$1 [L,R]&nbsp; #(I do a
rewrite to a normal HTTP connection<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ...<br>
- but with this configuration, I have the following problem:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; - connections to B:443, C:443 or D:443
are correctly rewrite to
B:80, C:80 or D:80 (it is perfect for me!!!) but...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; - If I try to connect to A:80, web is
not displayed. First
rewrite is done OK, but when it executes *:443, it seems that
%{SERVER_NAME} is not equal to A, so apache does another rewrite to
http (a loop?)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; - If I try to connect to A:443, the same:
%{SERVER_NAME} is not
equal to A</blockquote>
Can anyone help me!?!?!?!?!?!<br>

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message