502Bad Gateway
A server acting as a gateway got an invalid response from the server behind it, so it has nothing valid to pass on.
Browse all HTTP status codesWhen you see it
The front-facing server is working. Something behind it is not. Common causes are an application that crashed or is restarting, a process listening on a different port than expected, or a backend that returned something malformed.
During a deployment, brief 502s are normal while the old process stops and the new one starts. Sustained 502s mean the new process never came up.
What to do about it
As a visitor, wait and reload. 502s are often short-lived because they usually accompany a restart.
If you run the site, check whether the application process is actually running and listening where the gateway expects it, then read the application log rather than the gateway log. The gateway only knows it got a bad answer, not why.
Often confused with
504 Gateway Timeout
502 means the backend replied with something invalid. 504 means it did not reply at all in time. One is a broken answer, the other is no answer.
503 Service Unavailable
503 is a deliberate refusal because the server is overloaded or in maintenance. 502 is an unplanned failure of something behind the gateway.
Look up another one
Open
Type a code, a partial code like 40, or any word from a name or description. Everything runs in your browser.
69 of 69 codes. Click a row to copy it.