I am trying to set up a reverse proxy to give access to several internal web servers from the internet. I have configured some name based virtual hosts with reverse proxy (I enabled proxy and proxy_http modules).
So far so good...
One of the servers happen to be a wordpress site. Wordpress will generate html pages containing its internal url (for css, etc...). So I am trying to use the proxy_html module to rewrite those urls on the reverse proxy. But I fail miserably.
Most of the documentation on the internet refer to the latest version of the module, but 12.04 ships with version 3.0.1, and I can't figure out how to make it work.
Here is what I have put in my virtual host conffile:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://192.168.1.12/
ProxyPassReverse / http://192.168.1.12/
ProxyHTMLURLMap http://192.168.1.12 http://www.example.com
#SetOuputFilter INFLATE;proxy-html;DEFLATE
</VirtualHost>
I expect any url containing http://192.168.1.12
produced by wordpress on server 192.168.1.12 to be translated into http://www.example.com
.
This does not happen.
I have tried to add other directives, but all failed:
ProxyHTMLEnable On
fails. It seems to be too new and not supported by this version of the module.
SetOuputFilter INFLATE;proxy-html;DEFLATE
fails also. Maybe I am missing a module to do that ? I have tried adding a2enmod filter, but it does not work either...
Well, can someone enlighten me on that ?
EDIT Noticed the mistyping in SetOuputFilter
? A t is missing... So SetOutputFilter proxy-html
is the way to go to get proxy_html working on 12.04. But I'll rather go for the other solution: tell wordpress to behave according to its public name and generate right urls from the beginning.