Our organization is remaking it's site. Someone had set up new site on new server. It can be accessed after putting an entry in /etc/hosts. And works perfectly when accessed this way.
But since most of the people involved, are not good with computers I've decided to setup a reverse proxy.
I don't have access to the site nor the server witch hosts it. I have an editor account on WordPress installed there.
I've put an entry in /etc/hosts of my private server and setup reverse proxy with following config, my server is running apache-2.2 under Debian stable:
<VirtualHost *:80>
ServerName xxx.xxx.xxx.xxx
ProxyRequests off
ProxyPass /some/prefix/ http://site.example.com/
ProxyPassReverse /some/prefix/ http://site.example.com/
ProxyHTMLURLMap http://site.example.com/ http://xxx.xxx.xxx.xxx/some/prefix/
<Location /some/prefix/>
SetOutputFilter INFLATE;proxy-html;DEFLATE
ProxyHTMLURLMap http://site.example.com/ /some/prefix/
</Location>
ProxyPassReverseCookieDomain site.example.com xxx.xxx.xxx.xxx
ProxyPassReverseCookiePath / /some/prefix/
ProxyHTMLExtended On
</VirtualHost>
Almost everything works. I can't make new posts(the text editor does not load properly). Iceweasel's(Firefox) developer mode says:
(...)
[00:13:33.365] GET http://xxx.xxx.xxx.xxx/some/prefix/wp-includes/js/tinymce/langs/pl.js?wp-mce-4107-20141130 [HTTP/1.1 404 Not Found 399ms]
(...)
[00:13:33.648] Failed to load: http://xxx.xxx.xxx.xxx/some/prefix/wp-includes/js/tinymce/langs/pl.js
[00:13:46.733] POST http://xxx.xxx.xxx.xxx/wp-admin/admin-ajax.php [HTTP/1.1 404 Not Found 102ms]
I've omitted non errors.
It seems to me that Apache is not rewriting something.
Any ideas?
Best Answer
Here my working config for your case.
Some explanations
I have to set
ProxyHTMLLinks
because there are some errors in apache log below. The configuration was ripped from this blog post.Parameter
RequestHeader unset Accept-Encoding
was used to substituting parameterSetOutputFilter INFLATE;proxy-html;DEFLATE
. The effect is traffic between proxy and real wordpress wasn't compressed. See this page for the details.URL
wp-admin/admin-ajax.php
was defined and called by javascript. ParameterProxyHTMLExtended On
should do this job.URL
wp-admin/admin-ajax.php
defined without domain (you can see it when clicked View Page Source in Firefox). This caused parameterhttp://site.example.com/ /some/prefix/
doesn't match this string. So, I set new parameterProxyHTMLURLMap /wp-admin/ /some/prefix/wp-admin/
for regular string.ProxyHTMLURLMap \/wp-admin\/ \/some\/prefix\/wp-admin\/
for escaped string.