当使用mod_proxy时,是否有可能不发送一个301永久移动响应给客户端? 我希望客户尽可能不透明地处理反向代理。
我的虚拟主机设置:相关代码片段:
ProxyPreserveHost On ProxyPass /GTM http://192.168.1.27/GTM ProxyPassReverse /GTM http://192.168.1.27/GTM
wget localhost/GTM
:
--2011-09-27 21:54:22-- localhost/GTM Resolving localhost... ::1, 127.0.0.1 Connecting to localhost|::1|:80... failed: Connection refused. Connecting to localhost|127.0.0.1|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: localhost/GTM/ [following] --2011-09-27 21:54:22-- localhost/GTM/ Reusing existing connection to localhost:80. HTTP request sent, awaiting response... 200 OK
除非你用RewriteRule ... [R=301]
或者Redirect
来告诉Apache,否则Apache不会生成RewriteRule ... [R=301]
。
您正在代理的服务器是生成redirect的服务器。 尝试在Apache中设置ProxyPreserveHost On
,以防应用程序试图执行特定的主机名。