Problems with Rewrite and SSL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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:

- my server has configured 4 virtual hosts: A, B, C and D

- 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.
<VirtualHost A:80>
       ...
        ServerName A
        RewriteEngine On
        RewriteLog /var/log/apache2/http_rewrite_log
        RewriteLogLevel 9
        RewriteCond %(SERVER_PORT) !^443$
        RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
       ...
</VirtualHost>
- 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:

- I'm trying to configure a condition for doing HTTPS rewrite or not (into ssl site):
<VirtualHost *:443>
       ...
        ServerName A #(<----look at this)
        RewriteCond %(SERVER_NAME) !A$  #(in other words, if I'm trying to connect with SSL support to a site with no SSL support)
        RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [L,R]  #(I do a rewrite to a normal HTTP connection
       ...
- but with this configuration, I have the following problem:
       - 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...
       - 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?)
       - If I try to connect to A:443, the same: %{SERVER_NAME} is not equal to A


Can anyone help me!?!?!?!?!?!


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

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux