httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pi...@goldfisch.at
Subject Re: [users@httpd] strange behaviour of mod_vhost_alias
Date Tue, 19 Nov 2002 13:22:51 GMT

> Summary: Apache looks at the ServerName and ServerAlias inside each
> virtual-host block.  If it finds one that matches the Host: header sent by
> the client, that is the block it uses.  If it can't find any match, it
> uses the first listed virtual host.

thnx for your reply. I read the docs carefully but the effect I
mentioned is not described and doesnt follow the above logic.

if there is a VirtualHost-section with a servername-directive
inside that matches the original hostname (reverselookup of the IP)
then the above seems not to be true.

example (which doesnt make sense, but its good to proove my statement)

x1.goldfisch.at, x2.goldfisch.at, c2.goldfisch.at all resolve to
62.99.149.139.  A reverse lookup on this IP is c2.goldfisch.at


ServerName x1.goldfisch.at

NameVirtualHost 62.99.149.139:80
 
<VirtualHost 62.99.149.139:80>
ServerName goldfisch.at
DocumentRoot /data/apache/goldfisch/goldfisch
</VirtualHost>
 
<VirtualHost 62.99.149.139:80>
  VirtualDocumentRoot /data/apache/%0:%p
</VirtualHost>
 
<VirtualHost 62.99.149.139:80>
ServerName c2.goldfisch.at
DocumentRoot /data/apache/justfortest
</VirtualHost>

If the client wants to fetch goldfisch.at, then the first
VirtualHost-ServerName matches and DocumentRoot ist
/data/apache/goldfisch/goldfisch

If the client wants to fetch x2.goldfisch.at then no
VirtualHost-ServerName matches and therefore the first VirtualHost is
taken which leads to DocumentRoot /data/apache/goldfisch/goldfisch again.

But now:

If the clients request c2.goldfisch.at

One would expect that the last VirtualHost matches and the
DocumentRoot is /data/apache/justfortest.  But this is not true !!
Apache doesnt take the first VirtualHost either (in that case the
DocumentRoot would be /data/apache/goldfisch/goldfisch). !!

Apache uses as Documentroot for this request the second VirtualHost
that has no ServerName specified and DocumentRoot is therefore
/data/apache/c2.goldfisch.at:80 which is completely unexpected to me.


I prooved this effect on several machines and several IP's and its the
same everywhere. Is this intendend to be that way ?


thnx,
peter





On Mon, Nov 18, 2002 at 07:45:22PM -0500, Joshua Slive wrote:
> 
> On Tue, 19 Nov 2002 pilsl@goldfisch.at wrote:
> > All these <VirtualHost>-Sections are identical and all works but the
> > one using "goldfisch.at" (where apache tries to access
> > "/data/apache/goldfisch.at:80/test") As soon as I outcomment the first
> > section (specifying the VirtualDocumentRoot) it works for goldfisch.at
> > also !!
> >
> > Thats strange.
> >
> > Another things I dont understand:
> >
> > If I dont put the section that specifies the VirtualDocumentRoot as
> > first, but any other then the VirtualDocumenRoot-statement is ignored
> > and the DocumentRoot from the first section is taken instead.
> 
> You need to carefully read
> http://httpd.apache.org/docs-2.0/vhosts/name-based.html
> to understand how matching works in name-based virtual hosts.
> 

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

-- 
mag. peter pilsl
IT-Consulting
tel: +43-699-1-3574035
fax: +43-699-4-3574035
pilsl@goldfisch.at
http://www.goldfisch.at

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