“ProxyPreserveHost” like in Apache 1.3

If you reached here, you have certainly tried to use “ProxyPreserveHost On” in Apache 1.3. You must use Apache 2.0 or patch Apache 1.3 to get this functionnality. If none of them is an option for you and you’re not using an infinite list of vhosts (wildcards), you can still use multiple vhosts, like this.

<VirtualHost *:80>
ProxyPass / http://www.example.com/
ProxyPassReverse / http://example.com/
ServerName www.example.com
ServerAlias example.com

<VirtualHost *:80>
ProxyPass / http://secure.example.com/
ProxyPassReverse / http://secure.example.com/
ServerName secure.example.com

<VirtualHost *:80>
ProxyPass / http://backstage.example.com/
ProxyPassReverse / http://backstage.example.com/
ServerName backstage.example.com

You can even generate the configuration using some script if you have a quite long list of vhosts to set up (better to include the generated file using the Include directive then).

You’ll also have to set up your /etc/hosts file on the apache server to reach the real server behind the proxy. You can also set up a local DNS if you use one. The fact is that you need to reach the local server from the apache proxy. Using this technique, you can pass the correct host to the local server.