Josh (the blog)

I’ve delivered simple, clear and easy-to-use services for 20 years, for startups, scaleups and government. I write about the nerdy bits here.


@joahua

VirtualHost, mod_proxy, and Apache HTTP 2.0 documentation

I 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!