502 Bad Gateway
A gateway or proxy received an invalid response from the upstream server.
| Class | Server error (5xx) |
|---|---|
| Defined in | RFC9110, Section 15.6.3 |
| Cacheable by default | No, unless explicit freshness headers allow it |
Common causes
- The upstream application server crashed or is not running.
- A reverse proxy or load balancer got an invalid reply from the backend.
What to do
Check that the upstream service is running and reachable, review proxy timeouts and read both proxy and application logs.
Related codes
- 503 Service Unavailable: The server is not ready to handle the request, often because of overload or maintenance.
- 504 Gateway Timeout: A gateway or proxy did not get a response from the upstream server in time.
- 500 Internal Server Error: The server hit an unexpected condition that stopped it from fulfilling the request.