Apache 2.2反向代理无法正常工作

5 reverse-proxy apache2 proxypass

我正在尝试设置我的apache(版本2.2.3)作为反向代理.我在公共服务器上配置了apache,如下所述http://www.askapache.com/htaccess/reverse-proxy-apache.html

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
LoadFile   /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so

ProxyRequests off
ProxyPass /app1/ http://internal1.example.com/page1/
ProxyPassReverse /app1/ http://internal1.example.com/page1/
ProxyHTMLURLMap http://internal1.example.com/page1/ /app1/


internal1是本地网络中的其他服务器.

主页(www.example.com/app1/)显示正确,但是当我的内部服务器进行重定向时出现问题.在这种情况下,我的浏览器(Firefox 3.5.3或Internet Explorer 7)搜索本地网络中的地址(internal1.example.com/page1/).对我来说,apache忽略了ProxyPassReverse指令.

小智 4

就在ProxyPass添加这个参数之前ProxyPreserveHost On

这将保留主机。(http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost)