The Complete Configuration
We are now in a position to write a complete configuration for our
reverse proxy. Here is a bare minimum, that ignores extended
urlmapping:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module modules/mod_headers.so
LoadFile /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so
ProxyRequests off
ProxyPass /app1/ http://internal1.example.com/
ProxyPass /app2/ http://internal2.example.com/
ProxyHTMLURLMap http://internal1.example.com /app1
ProxyHTMLURLMap http://internal2.example.com /app2
<Location /app1/>
ProxyPassReverse /
SetOutputFilter proxy-html
ProxyHTMLURLMap / /app1/
ProxyHTMLURLMap /app1 /app1
RequestHeader unset Accept-Encoding
</Location>
<Location /app2/>
ProxyPassReverse /
SetOutputFilter proxy-html
ProxyHTMLURLMap / /app2/
ProxyHTMLURLMap /app2 /app2
RequestHeader unset Accept-Encoding
</Location>
Of course, there's more than one way to do it. Our configuration would
actually have been simpler if we'd used Virtual Hosts for each
application server. But that takes you beyond the realm of Apache
configuration and into DNS. If you don't fully understand that (or if
you think "why can't I see my domain" is a webserver question), then
please don't try using virtual hosts for this.