You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Gunter Verbocht <gu...@verbocht.be> on 2003/01/25 21:40:01 UTC

[users@httpd] mod proxy gives strange results

Hi,

I used the mod_proxy to forward certain URL's to other servers. Now I
have noticed, that if I have 2 virtual hosts, that it gives a lot off
weird results. I have at the moment this configuration in httpd.conf:

<VirtualHost *>
Servername www.basicdomain.com
Serveralias basicdomain.com
DocumentRoot "/usr/local/www/data"
</VirtualHost>

<VirtualHost domain1.com>
ServerName www.domain1.com
Serveralias domain1.com
DocumentRoot /usr/local/www/domain1_com
ProxyPass / http://other-server.com/domain1/
ProxyPassReverse / http://other-server.com/domain1/
</VirtualHost>

<VirtualHost domain2.com>
ServerName www.domain2.com
Serveralias domain1.com
DocumentRoot /usr/local/www/domain2_com
ProxyPass / http://other-server.com/domain2/
ProxyPassReverse / http://other-server.com/domain2/
</VirtualHost>

When I go to domain1.com, the correct website is loaded
(http://other-server.com/domain1/). But when I go to basicdomain.com or
to domain2.com, I also get the website from domain1.com!!

What is wrong in this configuration?


Regards,

Gunter Verbocht



---------------------------------------------------------------------
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] mod proxy gives strange results

Posted by Joshua Slive <jo...@slive.ca>.
On Sat, 25 Jan 2003, Gunter Verbocht wrote:
> <VirtualHost *>
>
> <VirtualHost domain1.com>
>
> <VirtualHost domain2.com>

Do not mix "*"ed and non"*"ed VirtualHosts.  Just use "*" in ALL the
<VirtualHost> containers and add a
NameVirtualHost *
directive.

If you are interested in the details: Apache performs a reverse lookup on
domain1.com and domain2.com to figure out the IP address to map to each
<VirtualHost>.  Since you have no NameVirtualHost directive, it treats
your virtual hosts as IP-based, and when a request comes in it simply
matches the requested IP address with the first matching <VirtualHost>
(excluding the "*" ones).

Joshua.

---------------------------------------------------------------------
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