apache 的http代理出错 502 Proxy Error
不久刚部署好的网站,忽然访问报错提示错误
Http502ProxyError
Theproxyserverreceivedaninvalidresponsefromanupstreamserver.
TheproxyservercouldnothandletherequestGET/.
Reason:Errorreadingfromremoteserver
看了半天也没看出个所以然来,刚刚还好好的呢!过了一会网站又能打开了....
查看了一下apache的access_log。发现.....Get / HTTP/1.0....
这是ie5.5以下的版本访问过。所以又找来台ie5.5(挺难整,这年头这玩意少了!!)访问了一下,然后出错。在用别的机器访问错误还有。在刷新了一会又好了!
就这个问题Google了一下发现是mod_proxy的事,又G了一下他的文档
http://httpd.apache.org/docs/2.3/mod/mod_proxy.html
找到了这一段话For circumstances where mod_proxy is sending requests to an origin server that doesn't properly implement keepalives or HTTP/1.1, there are two environment variables that can force the request to use HTTP/1.0 with no keepalive. These are set via the SetEnv directive. These are the force-proxy-request-1.0 and proxy-nokeepalive notes.
译了一下大概是这意思(不是我译的)
当mod_proxy向一个没有正确实现持久连接(KeepAlive)或HTTP/1.1的原始服务器发送请求的时候,可以通过设置两个环境变量来发送不带持久连接(KeepAlive)的HTTP/1.0请求。这两个变量是通过SetEnv指令设置的。
以下是force-proxy-request-1.0和proxy-nokeepalive的例子:
<Location /buggyappserver/> ProxyPass http://buggyappserver:7001/foo/ SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 </Location>
最后在我的httpd.conf的VirtualHost里加上了上面的两行设置
<VirtualHost *:80> JkMount /hr/servlet/* worker1 JkMount /hr/*.jsp worker1 JkMount /hr/*.do worker1 ServerAdmin [email protected] ServerName www.iteye.com ServerAlias www.iteye.com.cn RewriteEngine On RewriteRule ^/$ /hr/ [R,P] SetEnv force-proxy-request-1.0.1 SetEnv proxy-nokeepalive 1 </VirtualHost>
重启apache,在拿ie5.5访问O了
相关推荐
yanghui0 2020-06-20
sicceer 2020-05-28
似水流年梦 2020-05-12
gdb 2020-05-08
zhaolisha 2020-05-06
wanghongsha 2020-04-19
hygbuaa 2020-02-26
用不完的好奇心 2020-02-13
wanghongsha 2020-01-17
zhglinux 2020-01-09
zhaolisha 2019-12-21
powerfj 2019-11-19
hygbuaa 2019-11-18
笑面依旧 2019-11-17
一世为白 2019-11-16
OwenJi 2019-11-15