I'm getting a 502 bad gateway error when using mod_proxy on Apache 2.2.3 proxying to Tomcat 5.5.
It works correctly when used directly via Tomcat (not via mod_proxy), so I assume the problem is on Apache's end. The problem arises when request takes longer than normal, but I'm yet to see any pattern. Sometimes two seconds are too long, sometimes seven.
Tomcat is used to host a Groovy/Grails based application.
Apache vhost config has these relevant entries:
ProxyRequests Off ProxyTimeout 1800 <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass http://DOMAIN:8180/ ProxyPassReverse http://DOMAIN:8180/ SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 </Location> UseCanonicalName off HostNameLookups off
Please note that I've added ProxyTimeout in an attempt to solve the problem (have helped in similar situations in the past), it didn't help.
These two lines are old, without them the situation is worse - error 502 on almost every request.
SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1