Bad Gateway 502 error with Apache mod_proxy and Tomcat

前端 未结 10 1721
北海茫月
北海茫月 2020-12-12 16:24

We\'re running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this:

Bad Gateway! The proxy server received an in

10条回答
  •  借酒劲吻你
    2020-12-12 16:50

    You can use proxy-initial-not-pooled

    See http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html :

    If this variable is set no pooled connection will be reused if the client connection is an initial connection. This avoids the "proxy: error reading status line from remote server" error message caused by the race condition that the backend server closed the pooled connection after the connection check by the proxy and before data sent by the proxy reached the backend. It has to be kept in mind that setting this variable downgrades performance, especially with HTTP/1.0 clients.

    We had this problem, too. We fixed it by adding

    SetEnv proxy-nokeepalive 1
    SetEnv proxy-initial-not-pooled 1
    

    and turning keepAlive on all servers off.

    mod_proxy_http is fine in most scenarios but we are running it with heavy load and we still got some timeout problems we do not understand.

    But see if the above directive fits your needs.

提交回复
热议问题