[Zope] apache + vhm & http-rfc compliance

Oliver Bleutgen myzope@gmx.net
Fri, 18 Jan 2002 16:43:46 +0100


I'm cc'ing one author of a vhm howto on this, couldn't find more 
contacts for relevant adresses.
There is a small issue with the often used rewrite rules for apache + 
virtual host monster. All examples I have seen look like (sorry for the 
  wrapping)

RewriteRule ^/(.*)
http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/$1 
[P]

But, as I had to find out, this isn't completely HTTP/1.1 compliant, in 
so far as the client may send a host-header _with_ port number, i.e.
Host: www.hostname.tld:80

which breaks above rules. When trying to leech my own site with wget,
I was very astounded to get an 404 error, regardless what I entered as 
an URL.

I use an extra condition to avoid that problem and do another rewrite if 
hostname has the port appended:

RewriteCond %{HTTP_HOST} ^.*:80$
RewriteRule ^/(.*) 
http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/$1 
[P]
http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/$1 
[P]

Just wanted to mention that before internet explorer 7.8SP13 decides it 
wants to use the above rfc-option and a ton of zope-sites break 
seemingly for no known reason.

Maybe VHM could/should be adapted?


cheers,
oliver