我们的组织正在改造它的网站。有人在新服务器上建立了新站点。将条目放入 /etc/hosts 后即可访问它。并且以这种方式访问时可以完美运行。
但是由于涉及的大多数人都不擅长计算机,因此我决定设置反向代理。
我无权访问该站点,也无权托管它的服务器。我在那里安装了 Wordpress 的编辑器帐户。
我在我的私人服务器的 /etc/hosts 中放置了一个条目并使用以下配置设置反向代理,我的服务器在 Debian stable 下运行 apache-2.2:
<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>
Run Code Online (Sandbox Code Playgroud)
几乎一切正常。我无法发布新帖子(文本编辑器未正确加载)。Iceweasel 的 (Firefox) 开发者模式说:
(...)
[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]
Run Code Online (Sandbox Code Playgroud)
我省略了非错误。在我看来,Apache 并没有重写某些东西。有任何想法吗?