ProxyHTML to rewrite URL



我已经设置了2个apache服务器。一个在端口80,另一个在端口8077。我想通过反向代理查看8077服务器上的所有内容。目前我有:

ProxyPreserveHost Off
ProxyHTMLInterp On
ProxyPass /translate/ http://www.example.com:8077/
ProxyPassReverse /translate/ http://www.example.com:8077/
ProxyHTMLURLMap / /translate/

这允许我进入网站的初始页面,但链接到图像,css和其他页面不起作用。

例如html中的css显示为

/css/style.css

在我想要的位置

/translate/css/style.css

让它从8077服务器获取文件。我能对当前设置做些什么来让它工作呢?

好了,这就是我最终让它工作的方法

ProxyPass /translate/ http://www.example.com:8077/
ProxyPassReverse /translate/ http://www.example.com:8077/
ProxyHTMLURLMap http://www.example.com:8087 /translate/
<Location /translate/>
   ProxyPassReverse /
   SetOutputFilter  proxy-html
   ProxyHTMLURLMap http://www.example.com:8077 /translate/
   ProxyHTMLURLMap / /translate/
   ProxyHTMLURLMap  /translate/ /translate/
   RequestHeader    unset  Accept-Encoding
</Location>

这似乎工作得很好。ProxyHTMLURLMap http://www.example.com:8077/translate/行只需要翻译一些基于"referer"的url,这些url导致一些页面最终试图直接从8077端口服务器提供服务。

最新更新