/~martin/ blog/ misc/ apache reverse proxy

Setting up an apache2 reverse proxy (updated)

If you want to use a reverse proxy with apache that appears to clients as foo.example.com but serves (cached) documents from bar.example.com:port/dir/ and follows redirects from bar.example.com then put the following in the vhosts configuration of foo.example.com:

ProxyRequests Off
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
ProxyPass / http://bar.example.com:port/dir/
ProxyPassReverse / http://bar.example.com:port/dir/

In addition you will need to enable the apache2 proxy and proxyhttp modules (eg with a2enmod proxy && a2enmod proxyhttp), then modify mods-enabled/proxy.conf and set ProxyRequests Off (you don't want an open proxy) and allow access from all.