Apache 正在端口 :80 接收请求,并将它们代理到端口 :8080 的 Jetty
The proxy server received an invalid response from an upstream server
The proxy server could not handle the request GET /.
我的困境:一切正常通常情况下(快速请求,处理几秒或几十秒的请求好的)。问题发生当请求处理需要很长时间时(一会儿?)。
如果我发出请求直接地到 Jetty 端口:8080 的请求已处理完毕。所以问题是有可能位于 Apache 和 Jetty 之间,我正在使用mod_proxy。如何解决?
我已经尝试了一些“技巧”与 KeepAlive 设置有关,但没成功。这是我当前的配置,有什么建议吗?
#keepalive Off ## I have tried this, does not help
#SetEnv force-proxy-request-1.0 1 ## I have tried this, does not help
#SetEnv proxy-nokeepalive 1 ## I have tried this, does not help
#SetEnv proxy-initial-not-pooled 1 ## I have tried this, does not help
KeepAlive 20 ## I have tried this, does not help
KeepAliveTimeout 600 ## I have tried this, does not help
ProxyTimeout 600 ## I have tried this, does not help
NameVirtualHost *:80
<VirtualHost _default_:80>
ServerAdmin [email protected]
ServerName www.mydomain.fi
ServerAlias mydomain.fi mydomain.com mydomain www.mydomain.com
ProxyRequests On
ProxyVia On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://www.mydomain.fi:8080/ retry=1 acquire=3000 timeout=600
ProxyPassReverse / http://www.mydomain.fi:8080/
RewriteEngine On
RewriteCond %{SERVER_NAME} !^www\.mydomain\.fi
RewriteRule /(.*) http://www.mydomain.fi/$1 [redirect=301L]
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
这也是失败请求的调试日志:
74.125.43.99 - - [29/Sep/2010:20:15:40 +0300] "GET /?wicket:bookmarkablePage=newWindow:com.mydomain.view.application.reports.SaveReportPage HTTP/1.1" 502 355 "https://www.mydomain.fi/?wicket:interface=:0:2:::" "Mozilla/5.0 (Windows; U; Windows NT 6.1; fi; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10"
[Wed Sep 29 20:20:40 2010] [error] [client 74.125.43.99] proxy: error reading status line from remote server www.mydomain.fi, referer: https://www.mydomain.fi/?wicket:interface=:0:2:::
[Wed Sep 29 20:20:40 2010] [error] [client 74.125.43.99] proxy: Error reading from remote server returned by /, referer: https://www.mydomain.fi/?wicket:interface=:0:2:::
答案1
我已经解决了这个问题。Keepalive=On
应该将其插入到ProxyPass
配置行中:
ProxyPass / http://www.dom.fi:8080/ retry=1 acquire=3000 timeout=600 Keepalive=On
看到
Keepalive=On
那里有?这很关键 ;)
答案2
如果您的代理 URL 没有以 结尾,也会出现此错误/
。两个路径都应该以 结尾,/
或者都不以 结尾。
答案3
您尝试过设置吗setenv proxy-initial-not-pooled 1
?
参考这里
答案4
对于我来说,删除服务器应用程序(PHP)中调用的标头值Transfer-Encoding" (binary)
解决了以下问题:
[proxy_http:error] [pid 17623] (22)参数无效: [客户端 127.0.0.1:44929] AH01102: 从远程服务器 0.0.0.0:80 读取状态行时出错
其余所有建议都表示喜欢 SetEnv proxy-initial-not-pooled
或Keep-Alive
不喜欢。