Occasional 502 bad gateway from Apache HTTP proxy
The content on this page relates to platforms that are not supported for Confluence. Consequently, Atlassian can not guarantee providing any support for the steps described on this page. Please be aware that this material is provided for your information only, and that you use it at your own risk.
Users will occasionally receive an error page reporting a "Bad gateway" condition. This means the proxy couldn't get a response from the application server.
This can result from a known issue in Apache, affecting versions 2.0.63 through to 2.2.3, and was marked as resolved with 2.2.4. Apache wasn't checking for one of the possible conditions for its connections to the application server, so would periodically (e.g. once in tens of thousands of requests) use a connection handle that had been reset by the application server.
Upgrade to the latest version of Apache httpd.
If you're using a web server compiled from source and have a strong reason not to upgrade, you also have the option of making a tiny edit to the source as described in one of the comments and recompiling.