httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Verbeeck <Kris.Verbe...@ubizen.com>
Subject [users@httpd] Incorrect VirtualHost mapping
Date Fri, 06 Feb 2004 08:51:15 GMT
Hello,

I've got a problem with a certain virtual host setup using Apache 2.
I have two virtual hosts defined in my Apache config, both on the
same IP address.  The first has the actual DNS name of the machine
as the ServerName.  The second one, has the IP address of the
machine as the ServerName.  Like so:

    Listen 10.0.0.1:8000
    NameVirtualHost 10.0.0.1:8000

    <VirtualHost 10.0.0.1:8000>
        ServerName mydns
        DocumentRoot /home/httpd/htdocs/DNS/
    </VirtualHost>

    <VirtualHost 10.0.0.1:8000>
        ServerName 10.0.0.1
        DocumentRoot /home/httpd/htdocs/IP/
    </VirtualHost>

Now, when I perform a request http://mydns:8000/index.html, I get
teh correct page from /home/httpd/htdocs/DNS/.  But when I request
http://10.0.0.1:8000/index.html then I get the same page, instead
of the one from /home/httpd/htdocs/IP/.

I understand that this happens if there is no Host header present
(the first matching virtual host is used).  But in my tests the
host header was present.

If I reverse the order of the virtual hosts in the configuration
file, then everything works as expected (because then the first
virtual host is the one with the IP address as ServerName).  But
this is not an option for my setup, because the list of virtual
hosts is generated and the order of the virtual hosts is undefined
and might change from one time at another.

Is there some way that I can configure Apache to also accept IP
address as ServerName and then to correctly map the request to a
virtual host?

-- 
ir. Kris Verbeeck
Software Engineer

Ubizen - Ubicenter - Philipssite 5 - 3001 Leuven - Belgium
T:  +32 16 28 70 64
F:  +32 16 28 70 77

Ubizen - We Secure e-business - www.ubizen.com

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


Mime
View raw message