我已经按照我在 Google 上找到的所有指南进行操作,但仍然无法解决这个问题!
我已经设法设置 mod_proxy 来拉回一个内部网站,但是该网站添加了指向菜单项的内部链接,这对外部用户不起作用,所以我试图从 .int
重写它们域到 .com
域。
我有以下虚拟主机。
<VirtualHost *:80>
ServerName shop.itmanx.com
ProxyRequests Off
ProxyPreserveHost On
#ProxyHTMLInterp On #used to be ProxyHTMLEnable
#ProxyHTMLExtended On #will parse all scripts and css files as well [slow if on]
ProxyPass / http://shop.itmanx.int/
ProxyPassReverse / http://shop.itmanx.int/
#ProxyHTMLURLMap / /test/
ProxyHTMLURLMap (.*)itmanx.int(.*) $1itmanx.com$2 [Rin]
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
我已确保组件已加载
[Sun Jan 29 14:59:46 2012] [warn] module proxy_module is already loaded, skipping
[Sun Jan 29 14:59:46 2012] [warn] module proxy_http_module is already loaded, skipping
[Sun Jan 29 14:59:46 2012] [warn] module proxy_html_module is already loaded, skipping
但没有链接被更改。那我错过了什么?
服务器是Ubuntu Server 11.10
最佳答案
万岁!!!感谢 Hudson 的人谁引用了以下内容:
Because hudson already compress its output, you can not use the normal proxy-html filter to modify urls:`
SetOutputFilter proxy-html
Instead you can use the following:
SetOutputFilter INFLATE;proxy-html;DEFLATE;
因为这一行,它现在可以工作了
<VirtualHost *:80>
ServerName shop.itmanx.com
SetEnv proxy-nokeepalive 1
ProxyPass / http://shop.itmanx.int/
ProxyPassReverse / http://shop.itmanx.int/
ProxyRequests Off
SetOutputFilter INFLATE;proxy-html;DEFLATE;
ProxyHTMLURLMap (.*)itmanx.int(.*) $1itmanx.com$2 [R]
</VirtualHost>
关于ubuntu apache2 mod_proxy 替换内部 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9054192/