You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Lars Eilebrecht <La...@unix-ag.org> on 1997/10/27 01:45:51 UTC
vhost matching and check_fulluri
Hi,
when I send a full uri in a request, eg. "http://server.name/" I can
access any name- or IP-based vhost (on any available port) regardless
to which IP address or port the request was sent.
Is this a bug or feature?
ciao...
--
Lars Eilebrecht - "Minds are like parachutes; they only
sfx@unix-ag.org - function when fully open." (Sir J.Dewar)
http://www.si.unix-ag.org/~sfx/
Re: vhost matching and check_fulluri
Posted by Dean Gaudet <dg...@arctic.org>.
[An old one from Lars].
On Tue, 28 Oct 1997, Lars Eilebrecht wrote:
> Here is my example config:
>
> Listen 192.168.0.254:80
> Listen 192.168.1.254:8080
>
> NameVirtualHost 192.168.0.254
>
> <VirtualHost 192.168.0.254>
> DocumentRoot /usr/home/sfx/httpd/htdocs/vhost1
> ServerName www.domain.tld
> </VirtualHost>
>
> <VirtualHost 192.168.1.254:8080>
> DocumentRoot /usr/home/sfx/httpd/htdocs/vhost2
> ServerName www.otherdomain.tld
>
>
> www.otherdomain.tld is an alias for 192.168.1.254 and www.domain.tld an alias
> for 192.168.0.254.
>
> A request to port 80 on 192.168.1.254 fails, because Apache is only listening
> on port 8080, but sending the request
>
> GET http://www.otherdomain.tld:80/ HTTP/1.1
>
> to port 80 on 192.168.0.254 returns vhost2.
> Yes ProxyRequests is turned on, but Apache doesn't Listen on Port 80 for
> www.otherdomain.tld. (?)
> Using the IP address in the request results in a correct "Could not connect
> to remote machine" message.
>
> Is it just me doing bogus things or is it Apache?
This is fixed. The behaviour now, which we should probably document more
clearly is:
When an absoluteURI is requested, and the scheme matches the request
protocol (i.e. http) then r->hostname will be set to the host from
the absoluteURI. *The port is ignored.* vhost matching proceeds as usual,
which uses the "physical" port that the request came in on to determine
what vhosts to consider.
At some point if there's a proxy involved, the proxy makes a similar
comparison. If ProxyRequests are turned on, then it asks the question
"do the hostname:port supplied in the absoluteURI match r->server?"
if the answer is yes then it won't proxy the request. Otherwise it
will proxy the request.
Suppose we have this config, no proxy:
Listen 80
Listen 8080
<VirtualHost 10.1.1.1:80>
ServerName v1
</VirtualHost>
<VirtualHost 10.1.1.1:8080>
ServerName v2
</VirtualHost>
Then any request on 10.1.1.1:80 regardless of the absoluteURI is served
by v1. Similarly for v2.
Listen 80
Listen 8080
<VirtualHost 10.1.1.1:80>
ServerName v1
</VirtualHost>
<VirtualHost 10.1.1.1:8080>
ServerName v2
ProxyRequests on
</VirtualHost>
Any request to 10.1.1.1:80 regardless of the absoluteURI is served by
v1. A request to 10.1.1.1:8080 with either of these absoluteURIs:
http://v2:8080/
http://10.1.1.1:8080/
will be served by v2 directly. All other absoluteURIs will be proxied.
So for example "http://v2/" would be proxied (and would result in
a request to v1 actually). The server will proxy query itself on
different addresses (it also did this before my work though).
Dean
Re: vhost matching and check_fulluri
Posted by Lars Eilebrecht <La...@unix-ag.org>.
According to Dean Gaudet:
> This would be a bug if you're refering to 1.3. But given that I tested
> this stuff I'm surprised.
*blush* I'm stupid... I had ProxyRequests turned on. <:-}
I should stop testing such stuff after 2 a.m. 8-)
But there is still one thing that seems bogus to me.
Here is my example config:
Listen 192.168.0.254:80
Listen 192.168.1.254:8080
NameVirtualHost 192.168.0.254
<VirtualHost 192.168.0.254>
DocumentRoot /usr/home/sfx/httpd/htdocs/vhost1
ServerName www.domain.tld
</VirtualHost>
<VirtualHost 192.168.1.254:8080>
DocumentRoot /usr/home/sfx/httpd/htdocs/vhost2
ServerName www.otherdomain.tld
www.otherdomain.tld is an alias for 192.168.1.254 and www.domain.tld an alias
for 192.168.0.254.
A request to port 80 on 192.168.1.254 fails, because Apache is only listening
on port 8080, but sending the request
GET http://www.otherdomain.tld:80/ HTTP/1.1
to port 80 on 192.168.0.254 returns vhost2.
Yes ProxyRequests is turned on, but Apache doesn't Listen on Port 80 for
www.otherdomain.tld. (?)
Using the IP address in the request results in a correct "Could not connect
to remote machine" message.
Is it just me doing bogus things or is it Apache?
ciao...
--
Lars Eilebrecht - Bugs come in through open Windows.
sfx@unix-ag.org
http://www.si.unix-ag.org/~sfx/
Re: vhost matching and check_fulluri
Posted by Dean Gaudet <dg...@arctic.org>.
This would be a bug if you're refering to 1.3. But given that I tested
this stuff I'm surprised.
if (r->hostname || (r->hostname = table_get(r->headers_in, "Host")))
check_hostalias(r);
Hostnames from the URI and hostnames from the headers are treated
equivalently. My vhost test suite tested a bunch of cases where I sent
the wrong host to an ip address and always got the server attached to
the address rather than the host I specified.
If you're referring to 1.2 then this is a known bug.
Dean
On Mon, 27 Oct 1997, Lars Eilebrecht wrote:
> Hi,
>
> when I send a full uri in a request, eg. "http://server.name/" I can
> access any name- or IP-based vhost (on any available port) regardless
> to which IP address or port the request was sent.
>
> Is this a bug or feature?
>
>
> ciao...
> --
> Lars Eilebrecht - "Minds are like parachutes; they only
> sfx@unix-ag.org - function when fully open." (Sir J.Dewar)
> http://www.si.unix-ag.org/~sfx/
>