使用APACHE反向代理IIS的时候,总会出现以下的错误:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.
Reason: Error reading from remote server
对于这个问题官方给出的说明是:当mod_proxy向一个没有正确实现持久连接(KeepAlive)或HTTP/1.1的原始服务器发送请求的时候,可以通过设置两个环境变量来发送不带持久连接(KeepAlive)的HTTP/1.0请求。这两个变量是通过SetEnv指令设置的。
解决方式如下:只要将下边两段代码复制到httpd.conf里边就可以了.
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
可以复制到<VirtualHost *>之间</VirtualHost >,仅在虚拟机内有效。
也可以复制到<VirtualHost>外边,让所有的反向代理都可以用到上边两段代码。