apache的http代理出现 502 Proxy Error

前不久刚部署好的网站,忽然访问报错提示错误
引用

Http 502 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

看了半天也没看出个所以然来, 刚刚还好好的呢!过了一会网站又能打开了....
查看了一下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的例子:

  1. <Location /buggyappserver/>  
  2.   ProxyPass http://buggyappserver:7001/foo/  
  3.   SetEnv force-proxy-request-1.0 1  
  4.   SetEnv proxy-nokeepalive 1  
  5. </Location>   

最后在我的httpd.conf的VirtualHost里加上了上面的两行设置
  1. <VirtualHost *:80>   
  2.    JkMount /hr/servlet/* worker1   
  3.    JkMount /hr/*.jsp worker1   
  4.    JkMount /hr/*.do worker1   
  5.    ServerAdmin njgnini@163.com   
  6.    ServerName www.iteye.com   
  7.    ServerAlias www.iteye.com.cn   
  8.    RewriteEngine On   
  9.    RewriteRule ^/$ /hr/ [R,P]         
  10.      
  11.    SetEnv force-proxy-request-1.0.1   
  12.    SetEnv proxy-nokeepalive 1   
  13. </VirtualHost>   

重启apache,在拿ie5.5访问O了
502 Proxy Error是指在使用代理服务器时遇到的错误。根据引用内容,这个错误通常是由于代理服务器配置不正确导致的。具体而言,可能涉及到代理请求的设置、代理的保持活动连接、以及代理的反向代理配置等方面。 根据引用内容,这个错误还可能是由于ISA服务器拒绝了指定的URL导致的。在这种情况下,可能需要检查ISA服务器的访问规则和配置,确保允许访问所需的URL。 根据引用内容,解决502 Proxy Error的方法有多种选择。例如,可以在访问规则中允许内网访问内网,或者在客户机浏览器中设置不使用代理访问特定的内网服务器。此外,还可以在ISA管理器中配置访问内网时不使用Web代理。具体的解决方法可以根据具体情况选择适合的方法来解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [apache2.4 tomcat7 出现502 Proxy Error错误](https://blog.csdn.net/y243234469/article/details/52420307)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [502 Proxy Error。The ISA Server denied the specified Uniform Resource Locator (URL).](https://blog.csdn.net/weixin_30699955/article/details/95110128)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值