VirtualHost, mod_proxy, and Apache HTTP 2.0 documentation
02 Jan 2006I had to setup a virtual host that proxied through to another server today, and found the Apache 2.0 documentation on that matter particularly unhelpful for a rather trivial reason.
Here’s their broken version:
<VirtualHost *:*> ProxyPreserveHost On ProxyPass / http://192.168.111.2 ProxyPassReverse / http://192.168.111.2/ ServerName hostname.example.com </VirtualHost>
Here’s my working version:
<VirtualHost *:*> ProxyPreserveHost On ProxyPass / http://192.168.111.2/ ProxyPassReverse / http://192.168.111.2/ ServerName hostname.example.com </VirtualHost>
Spot the difference.
Yes, it was as simple as an omitted trailing slash.
Only takes a minute or two to figure out what’s going wrong, but it’s pretty darn annoying for that minute: I assume, as would many people, that documentation is generally infallible — its purpose being the cure to various software ailments, not the cause! Ah well. I’d have edited the Apache documentation, but it’s not a wiki and I can’t be bothered joining whatever mailing list I’d have to join to get one character added to their site!