Work required me to build an apache reverse proxy so that an internal server was made visible to the outside world. After much fumbling it appears that
mod_proxy_html is required to handle the domain address rewriting.
RedHat and CentOS can use EPEL (https://fedoraproject.org/wiki/EPEL) for this package:
yum install epel-release yum install mod_proxy_html
For this example we will use
www.example.com as the main server on which the proxy will exist and
192.168.1.1 as the internal server.
Assuming you wanted to place the proxy within a folder,
/zzz within the main server then the following config changes could be applied to
ProxyRequests off ProxyPass /zzz/ http://192.168.1.1/ ProxyHTMLURLMap http://192.168.1.1 /zzz ProxyPassReverse / ProxyHTMLURLMap / /zzz/ ProxyHTMLURLMap /zzz /zzz SetOutputFilter proxy-html RequestHeader unset Accept-Encoding
If you would prefer this to be a top-level proxy then the following configuration would be used. Also, note how specific directories are excluded from being proxied by use of the exclamation mark:
ProxyRequests off ProxyPass /bar ! ProxyPass /foo ! ProxyPass / http://192.168.1.1/ ProxyHTMLURLMap http://192.168.1.1 http://www.example.com SetOutputFilter proxy-html RequestHeader unset Accept-Encoding
SetOutputFilter tells apache to use
mod_proxy_html for output which also handles the URL rewrite fixing (via
ProxyHTMLURLMap). In the event that you face issues try replacing:
SetOutputFilter proxy-html RequestHeader unset Accept-Encoding
To help resolve issues you can add extra debugging to the apache log with these config options:
ProxyHTMLLogVerbose On LogLevel Debug
Restart apache for the changes to take place.
Credit where credit is due: