The following reply was made to PR protocol/1582; it has been noted by GNATS.
From: Todd Vierling <[EMAIL PROTECTED]>
To: Dean Gaudet <[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 08:52:35 -0500 (EST)
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.
I was checking for unqualified requests by looking at %{HTTP_HOST} and
comparing it to the null string in a RewriteCond in my first vhost:
RewriteRule ^/errors/(.*) /errors/$1 [L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^.*$ http://www.duh.org/errors/upgrade.html [R,L]
The URL would then be redirected to an error page telling you that you
needed to upgrade your browser to one that supports vhosts. Problem with
all this is, HTTP_HOST is only set when a Host: header is actually present,
in HTTP/1.1 style. I was under the mistaken impression that it was set on
any virtual host request, under any version of the protocol. I have now
tried doing a slightly different, and trickier, RewriteCond:
RewriteRule ^/errors/(.*) /errors/$1 [L]
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^/
RewriteRule ^.*$ http://www.duh.org/errors/upgrade.html [R,L]
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.
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"?
=====
===== Todd Vierling (Personal [EMAIL PROTECTED]; Business [EMAIL PROTECTED])
=====
== "There's a myth that there is a scarcity of justice to go around, so
== that if we extend justice to 'those people,' it will somehow erode the
== quality of justice everyone else receives." -- Maria Price