mod_accessibility

Reverse Proxying

This is basically easier than standard proxying, as the proxy administrator has some knowledge of the content to be proxied and can at least set up defaults that work well with them.

To set up a reverse proxy for www.example.com at path /www.example.com/ on your server, you need firstly the directives for mod_proxy:

ProxyPass	/www.example.com/	http://www.example.com/
ProxyPassReverse	/www.example.com/	http://www.example.com/

Now, to complete the proxying, you need to ensure that links in the pages at www.example.com resolve correctly relative to the proxy. The AccessibilityURLMap directive does this. There are usually two cases to deal with:

  1. URLs of the form /path/to/page.foo need to be rewritten to the proxy's address space; in this example to /www.example.com/path/to/page.foo. This is dealt with by
    AccessibilityURLMap	/	/www.example.com/
    
    to rewrite URLs starting with a slash.
  2. URLs of the form http://www.example.com/anything need to be rewritten to the proxy's address space:
    AccessibilityURLMap	http://www.example.com/	/www.example.com/
    

If you are reverse-proxying other servers - eg to provide external access to an intranet in private address space - you can of course add similar directives for the other servers proxied.

Tutorial

A tutorial on reverse proxying with Apache (by the author of mod_accessibility) is now available at ApacheWeek. It is based on the more limited mod_proxy_html, but the details are basically identical.

Reverse Proxy Demonstrator

We have mod_accessibility running at mirrors.webthing.com where it is serving as reverse proxy for selected sites. Sites may be added or removed by request. At the time of writing, a couple of useful sites are available: