Occasional 502 bad gateway from Apache HTTP proxy
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
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.
Problem
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.
Cause
This can result from a known issue in Apache, which affected versions 2.0.63 through 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 it would periodically (e.g., once in tens of thousands of requests) use a connection handle that had been reset by the application server.
Resolution
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.