← All status codes5xx – Server Error

HTTP 502 – Bad Gateway

The server, acting as a gateway or proxy, received an invalid response from the upstream server.

Common use case

A classic sign of a crashed or misbehaving backend behind a reverse proxy or load balancer - the proxy is up, but whatever it's forwarding to isn't responding sensibly.

Example

HTTP/1.1 502 Bad Gateway

<html><body>Bad Gateway</body></html>

History

Part of HTTP/1.0 (RFC 1945, 1996).

Did you know?

It is one of the most commonly monitored codes for uptime checks because it usually points squarely at the origin server, not the network in front of it.