You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Karim Hamed-abdelouahab <ka...@gmail.com> on 2005/07/28 11:34:37 UTC

[users@httpd] three web on the same machine but I get the wrong page for a request using HTTPS (client side)

Hello everybody,

I've a web machine running on Fedora core 3.0. Apache 1.33 with mod_ssl. 

This is an extract of my configuration file: 

<IfDefine SSL>
Listen 80
Listen 443
</IfDefine>

<VirtualHost xxx.xxx.xxx.37:80>
ServerAdmin someoneverygood@athome.com
DocumentRoot /var/www/secret
ServerName ultra.secret.com
ErrorLog /usr/apache/logs/secret_cl/error_log.log
</VirtualHost>

<VirtualHost xxx.xxx.xxx.37:443>

#  General setup for the virtual host
NameVirtualHost xxx.xxx.xxx.37
DocumentRoot "/var/www/secret/web/"
ServerName www.secret.com
ServerAdmin verygood@me.com
ErrorLog /usr/apache/logs/secret_prod/error_log
TransferLog /usr/apache/logs/secret_prod/access_log

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on


<VirtualHost xxx.xxx.xxx.38:443>


#  General setup for the virtual host
NameVirtualHost xxx.xxx.xxx.38
DocumentRoot "/var/www/secret_dev/web/"
ServerName dev.secret.com
ServerAdmin verygood@home.com
ErrorLog /usr/apache/logs/secret_dev/error_log
TransferLog /usr/apache/logs/secret_dev/access_log

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

All the domaine are registred on a DNS that point to the web server:
dev.secret.com, www.secret.com and finally ultra.secret.com

Every thing works fine when I try to reach ultra.secret.com on HTTP
protocole. But when I try to reach ultra.secret.com on HTTPS I get
www.secret.com page. How can I configure apache so that I will get
ultra.secret.com on HTTP even I request ultra.secret.com pages on
HTTPS.

Thank you in advance.
Karim

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] three web on the same machine but I get the wrong page for a request using HTTPS (client side)

Posted by Krist van Besien <kr...@gmail.com>.
On 7/28/05, Karim Hamed-abdelouahab <ka...@gmail.com> wrote:
> Hello everybody,
> 
> I've a web machine running on Fedora core 3.0. Apache 1.33 with mod_ssl.
> 
> This is an extract of my configuration file:
> 
> <IfDefine SSL>
> Listen 80
> Listen 443
> </IfDefine>
> 
> <VirtualHost xxx.xxx.xxx.37:80>
> ServerAdmin someoneverygood@athome.com
> DocumentRoot /var/www/secret
> ServerName ultra.secret.com
> ErrorLog /usr/apache/logs/secret_cl/error_log.log
> </VirtualHost>
> 
> <VirtualHost xxx.xxx.xxx.37:443>
> 
> #  General setup for the virtual host
> NameVirtualHost xxx.xxx.xxx.37
> DocumentRoot "/var/www/secret/web/"
> ServerName www.secret.com
> ServerAdmin verygood@me.com
> ErrorLog /usr/apache/logs/secret_prod/error_log
> TransferLog /usr/apache/logs/secret_prod/access_log
> 
> #   SSL Engine Switch:
> #   Enable/Disable SSL for this virtual host.
> SSLEngine on
> 
> 
> <VirtualHost xxx.xxx.xxx.38:443>
> 
> 
> #  General setup for the virtual host
> NameVirtualHost xxx.xxx.xxx.38
> DocumentRoot "/var/www/secret_dev/web/"
> ServerName dev.secret.com
> ServerAdmin verygood@home.com
> ErrorLog /usr/apache/logs/secret_dev/error_log
> TransferLog /usr/apache/logs/secret_dev/access_log
> 
> #   SSL Engine Switch:
> #   Enable/Disable SSL for this virtual host.
> SSLEngine on
> 
> All the domaine are registred on a DNS that point to the web server:
> dev.secret.com, www.secret.com and finally ultra.secret.com
> 
> Every thing works fine when I try to reach ultra.secret.com on HTTP
> protocole. But when I try to reach ultra.secret.com on HTTPS I get
> www.secret.com page. How can I configure apache so that I will get
> ultra.secret.com on HTTP even I request ultra.secret.com pages on
> HTTPS.

You server is doing exactly what you told it to do. It is serving
requests to xxx.xxx.xxx.37:443 with pages from www.secret.com.
You must realise that the NameVirtualHost directive (which you should
place outside of the VirtualHost container anyway) has no effect for
SSL connections.

What you could do is use a rewrite rule:

RewriteCond %{HTTP_HOST} ultra.secret.com
RewriteRule  (.*) http://ultra.secret.com/$1 [R,L]

-- 
krist.vanbesien@gmail.com
Solothurn, Switzerland

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: three web on the same machine but I get the wrong page for a request using HTTPS (client side)

Posted by Joost de Heer <sa...@xs4all.nl>.
> <VirtualHost xxx.xxx.xxx.37:80>
> ServerName ultra.secret.com

> <VirtualHost xxx.xxx.xxx.37:443>
> ServerName www.secret.com

> Every thing works fine when I try to reach ultra.secret.com on HTTP
> protocole. But when I try to reach ultra.secret.com on HTTPS I get
> www.secret.com page. How can I configure apache so that I will get
> ultra.secret.com on HTTP even I request ultra.secret.com pages on
> HTTPS.

Because the https-site on that IP address is www.secret.com, and the
http-site is ultra.secret.com.

You could try mod_rewrite, and rewrite if the host-header for the request
is ultra.secret.com.

Something like

RewriteEngine on
RewriteCond %{HTTP_HOST} ultra.secret.com
RewriteRule (.*) http://%{HTTP_HOST}$1 [L]

Joost


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org