HTTP status codes / 5xx — Server error

502 Bad Gateway

What it means

A proxy or load balancer got an invalid response (or none) from the upstream server behind it. The middleman is fine; the thing behind it is not.

What causes it

Upstream app crashed or restarting, connection refused on the backend port, upstream returned garbage, backend TLS handshake failure. Common during deploys.

How to fix it

Operators: check whether the upstream process is running and reachable from the proxy (right port, right protocol, healthy TLS). During deploys: add health-checked rolling restarts so the proxy never routes to a dead instance.