The following reply was made to PR protocol/1582; it has been noted by GNATS.
From: Dean Gaudet <[EMAIL PROTECTED]>
To: Todd Vierling <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: Re: protocol/1582: VirtualHosts no longer work as part of HTTP/0.9
request
Date: Sat, 20 Dec 1997 12:22:18 -0800 (PST)
On Sat, 20 Dec 1997, Todd Vierling wrote:
> On Fri, 19 Dec 1997, Dean Gaudet wrote:
>
> : You've read the vhosts documentation, and you've updated your
> : configuration files appropriately, correct? And the server generates no
> : error_log entries when you boot it? If so can you provide a small example
> : config file that demonstrates this problem?
>
> Yep. vhosting with HTTP/1.1 style Host: headers works flawlessly (Lynx
> 2.7.1 and Netscape 4.04, my two major browsers, use this). However,
> checking again this morning, I found part of the problem.
>
> Under 1.2.x, the "outside virtual hosts" directives managed to catch
> requests without a virtual host, but under 1.3, the first vhost (not
> _default_!) catches them. So I had to find a way to make the first vhost
> intercept such unqualified requests, and redirect them. I used mod_rewrite.
What do you mean "outside virtual hosts"? Under 1.3 the first vhost on a
NameVirtualHost address catches any request which does not match any of
the other name-vhosts on that address; that's how it is documented.
_default_ catches only IP addresses which are otherwise unmatched, not names.
> but it seems that the %{REQUEST_URI} only includes the fully qualified
> request when a CGI such as env.cgi is run(!). Here, it is stripped of the
> http://host part.
This is a mod_rewrite problem, not a vhosting problem.
> Basically, I have no way, by testing environment variables at rewrite time,
> to see that a request had no virtual host information. Perhaps HTTP_HOST
> should always be set on a virtual host request, even an "old-style one"?
Any request that makes it to the first name-vhost did not match any of the
others. There's no need to look at the URL or the Host: header, apache
has already done it. You can do this:
NameVirtualHost a.b.c.d
<VirtualHost a.b.c.d>
ServerName some-arbitrary-name
RewriteEngine On
RewriteRule .* http://somewhereelse/upgrade.html [R]
</VirtualHost>
<VirtualHost a.b.c.d>
ServerName www.customer1.com
...
</VirtualHost>
<VirtualHost a.b.c.d>
ServerName www.customer2.com
...
</VirtualHost>
...
Dean