I am running:
Apache/2.2.15 (Unix) on CentOS release 6.6 (Final)
I am running a reverse proxy that forwards requests on to a tomcat server running on localhost:8080. My config looks like this:
<VirtualHost *:80>
....
<Proxy *>
Order deny,allow
Allow from all
AuthType Basic
AuthName “Username/Password”
AuthUserFile /etc/httpd/conf.d/users.auth
Require valid-user
</Proxy>
Setenv proxy-nokeepalive 1
Setenv proxy-sendcl 1
Setenv proxy-initial-not-pooled 1
SetEnv force-proxy-request-1.0 1
ProxyPass /analytics http://localhost:8080/analytics disablereuse=on ttl=1 smax=0
ProxyPassReverse /analytics http://localhost:8080/analytics
You can see I've chucked a whole load of stuff in there out of desperation - I've been trying to get this to work for several days.
Most of the queries work fine, but it seems particularly if I don't use the server for perhaps more than 15 minutes, when I return I get hanging, but it seems only on a POST request on the pages served from tomcat. The hang usually last 1 minute before the 502 error. Also I have seen it on GET pages but not recently, so it may be that some of the configuration changes I made changed that.
I've enabled debugging in the log and get:
[Sat Jan 30 21:28:49 2016] [error] [client 192.168.213.24] (70007)The timeout specified has expired: proxy: error reading status line from remote server localhost, referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [debug] mod_proxy_http.c(1414): [client 192.168.213.24] proxy: read timeout, referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [debug] mod_proxy_http.c(1465): [client 192.168.213.24] proxy: NOT Closing connection to client although reading from backend server localhost failed., referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [error] [client 192.168.213.24] proxy: Error reading from remote server returned by /analytics/msqlQuery, referer: http://analytics.mysite.com/analytics/msqlQuery
[Sat Jan 30 21:28:49 2016] [debug] proxy_util.c(2112): proxy: HTTP: has released connection for (localhost)
When I get the hanging behaviour, I don't see anything show up in the tomcat logs at all. I suspect that the call is never getting that far.
It's as if Apache thinks the connection is alive, but it's not somehow (even though I think I've configured it to get a fresh connection every time)
Many thanks for any assistance!