httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: more problems with Host:'s
Date Mon, 30 Sep 1996 13:38:06 GMT
An interest addition to these findings...

The patch I supplied fixed my problem completely. However, I use
NO named hosts. Only IP addresses.


> 
> Randy's patch (r->server->next ==> r->server) didn't change a thing.  to
"fix
> it" I had to place the vhost segment for what I was calling the "default"
> server at the end.
> 
> Here's the relevant sections from my httpd.conf file.  Hyperreal's primary
> address is 204.152.144.36.
> 
>   Port 8O
>   ServerName www.hyperreal.com
>   DocumentRoot /export/pub
> 
> <<These are the configs I am presuming would apply if a request to
> 204.152.144.36 came without a Host: header!!>>
> 
>   <VirtualHost 204.152.144.36>
>   ServerName www.grooveneedle.com
>   .....
>   </VirtualHost>
> 
>   <VirtualHost 204.152.144.36>
>   ServerName dev.apache.org
>   ...
>   </VirtualHost>
> 
>   <VirtualHost 204.152.144.36>
>   ServerName www.hyperreal.com
>   Redirect /axiom http://www.hyperreal.com/music/labels/axiom
>   ...(lots of stuff I want to ONLY apply to www.hyperreal.com)...
>   </VirtualHost>
> 
>   <VirtualHost 204.152.144.38>
>   ServerName www.apache.org
>   ....
>   </VirtualHost>
> 
>    etc...
> 
> In order for www.hyperreal.com to come up as the host for requests without a
> Host: header, it must be the *last* of the 204.152.144.36 vhosts.  Previously I
> had it as the *first*, and accesses were defaulting to dev.apache.org's vhost
> section.  This is a change that happened recently, as in the last few weeks at
> the most.
> 
> Now, THIS is where it gets interesting, and what is a real BUG compared to
> just being a confusing aspect of the current config situation. Let's say I 
> move the vhost segment for www.apache.org in between www.grooveneedle.com and
> dev.apache.org.  When I do that, EVERY request for dev.apache.org and
> www.hyperreal.com get shunted to www.grooveneedle.com.  If I move the vhost
> segment for www.apache.org in between dev.apache.org and www.hyperreal.com, the
> www.grooveneedle.com and dev.apache.org work fine, but www.hyperreal.com gets
> shunted to dev.apache.org.  It appears that only name-vhost segments before the 
> first IP-vhost segment are matched!
> 
> It looks like the ONLY acceptible config file format is
>  
>   VirtualHost name-vhost1
>   VH name-vhost2
>   ....
>   VH default-server
>   VH IP-vhost1
>   VH IP-vhost2
> 
> Etc.  Anyone have evidence to the contrary?  Does someone know the code well
> enough in this area to find the cause?
> 
> On 29 Sep 1996, Dean Gaudet wrote:
> > It doesn't seem screwy to me (mind you, I'm looking at 1.1.1 code):
> > 
> > www.hyperreal.com	IN A 204.152.144.36
> > www.grooveneedle.com	IN A 204.152.144.36
> > 
> > <virtualhost>s are stacked, so the last in the file is the first
> > match found.  Unless the request has something to differentiate it --
> > which "GET / HTTP/1.0" doesn't -- you get the first match found in
> > find_virtual_server.
> 
> Okay, this is the crux of my misunderstanding/problem statement.  I guess
> nowhere is the logic "if there's no Host header, default to the 'main' server
> on that IP number", and if that's the server's main IP number ("Port", outside
> of <vhost> segments), then it should bind to the same DocumentRoot which sits
> outside the <vhost> segments as well.  In fact the logic should check that the
> vhost segment with ServerName set to the same as ServerName set outside any
> <vhost> segment is the "default" server; presumably that was put there (as I
> did, and I know lots others do) to allow for certain configs to be scoped
> locally to the main server, not globally to all servers.
> 
> > Anyhow, since check_serverpath() searches from last <virtualhost> to first,
> > if you put "ServerPath /" into hyperreal's <virtualhost> section it will
> > become the default.
> 
> Or rearrange the order, as I did do.  Neither this or the above suggestion are
> intuitive, nor were they required before sometime in the last two weeks.
> 
> 	Brian
> 
> --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS




Mime
View raw message