HTTP 502 Bad Gateway
A proxy or gateway in front of your app got a bad response from the upstream. Usually means your app crashed or isn't responding.
What it means
502 says "I'm a gateway, and the thing behind me gave me nonsense." Usually that means your application server crashed, refused the connection, or sent a malformed HTTP response that the proxy couldn't parse. In Kubernetes / Docker setups, 502 is often what you see while a pod is restarting.
Most 502s have a smaller root cause than they look — a single deploy gone wrong, a process that ran out of memory and OOM-killed, or an idle connection timeout mismatch between the proxy and the app. Check the app server's logs and the proxy's error logs in parallel.
Common causes
- Application server crashed (OOM, segfault, unhandled exception that killed the process)
- Pod / container restarting after a deploy
- Upstream returning malformed HTTP
- Idle timeout mismatch between load balancer and origin
- Origin behind nginx / Caddy listening on the wrong port
How to fix it
- 1Check the application server's logs — the crash trace is usually there
- 2Roll back the most recent deploy if 502s started after a release
- 3Align keep-alive timeouts: the upstream's idle timeout must be longer than the proxy's
- 4Increase memory limits or fix the memory leak causing OOM
How Uptimera reports 502
Uptimera flags 502 as down. 502s during deploys are common; if you see them at other times, the underlying app is unhealthy even though the proxy is up.
Related codes
Internal Server Error
Generic server-side failure. Something blew up that the server didn't have a more specific response for.
Service Unavailable
The server is temporarily unavailable — overloaded, in maintenance, or intentionally not accepting traffic.
Gateway Timeout
A proxy in front of your app waited too long for an upstream response and gave up.
Catch 502s before your customers do
Uptimera monitors your URLs from multiple regions and alerts the moment a 502 starts firing. Free plan included.