我们使用Apache代理来使我们的应用程序服务器能够通过互联网访问特定的网站。 设置如下:
application servers --> apache proxy --> Internet website
某些请求失败,并在应用程序服务器日志中出现以下错误:
<head> <title>502 Proxy Error</title> </head><body> <h1>Proxy Error</h1> <p>The proxy server received an invalid response from an upstream server.<br /> The proxy server could not handle the request <em><a href="/link">POST nbsp;/link</a></em>.<p> Reason: <strong>Error reading from remote server</strong></p></p> </body>
以及apache error.log文件中的下面的debugging日志:
[Mon May 20 09:57:54 2013] [debug] mod_proxy_http.c(56): proxy: HTTP: canonicalising URL //myURL.com [Mon May 20 09:57:54 2013] [debug] proxy_util.c(1506): [client 172.20.101.71] proxy: https: found worker `https://myurl.com/` for `https://myurl.com/link` [Mon May 20 09:57:54 2013] [debug] mod_proxy.c(1015): Running scheme https handler (attempt 0) [Mon May 20 09:57:54 2013] [debug] mod_proxy_http.c(1973): proxy: HTTP: serving URL https://myurl.com/link [Mon May 20 09:57:54 2013] [debug] proxy_util.c(2011): proxy: HTTPS: has acquired connection for (mu=y url) [Mon May 20 09:57:54 2013] [debug] ssl_engine_io.c(1908): OpenSSL: I/O error, 5 bytes expected to read on BIO#136e90 [mem: 190593] [Mon May 20 09:57:54 2013] [debug] proxy_util.c(2067): proxy: connecting https://myurl.com/link to myurl.com:443 [Mon May 20 09:57:54 2013] [debug] proxy_util.c(2193): proxy: connected /link to myurl.com:443 [Mon May 20 09:57:54 2013] [debug] ssl_engine_io.c(1908): OpenSSL: I/O error, 5 bytes expected to read on BIO#136e90 [mem: 190593] [Mon May 20 09:57:54 2013] [info] [client ip] (131)Connection reset by peer: SSL input filter read failed. [Mon May 20 09:57:54 2013] [error] [client ip2] (131)Connection reset by peer: proxy: error reading status line from remote server myurl.com:443 [Mon May 20 09:57:54 2013] [debug] mod_proxy_http.c(1466): [client ip2] proxy: NOT Closing connection to client although reading from backend server "myurl.com:443 failed. [Mon May 20 09:57:54 2013] [error] [client ip2] proxy: Error reading from remote server returned by /link [Mon May 20 09:57:54 2013] [debug] proxy_util.c(2029): proxy: HTTPS: has released connection for (myurl.com)
任何想法如何我可以解决这个问题,知道大部分请求正在成功发送和响应正在正常接收。 所有的请求都是相同的长度和自动生成,所以问题不能在请求本身。
看起来像这个Apache Bugzilla中描述的问题。 解决scheme是在httpd.conf <Proxy>部分添加这些行
SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1
部署上述解决scheme后,我遇到了另一个问题,因为客户端正在使用HTTP / 1.1发送请求,并且代理被强制使用HTTP / 1.0按照以前的setEnv参数,这导致HTTP错误HTTP / 1.1 417期望失败 。 SO上的这个线程提到错误可以从客户端或代理端解决。
最后,基于这个页面 ,实施了代理方面的解决scheme。 现在我在<Proxy>部分有三个参数
SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 RequestHeader unset Expect early
我从昨天开始就一直在监控这个解决scheme,到现在为止它一直在运行。 我昨天也进行了500次交易,他们都成功了。
自那时起, 它已经被添加到Apache文档 。
检查SSL代理虚拟主机上是否同时SSLProxyCheckPeerCN off了SSLProxyVerify none和SSLProxyCheckPeerCN off 。