HTTP status code · RFC 9110, section 15.6.3
502 Bad Gateway
502 Bad Gateway means a proxy or gateway got an invalid response, or no usable response, from the upstream server behind it.
What 502 means
Something sits in front of your app (Nginx, a load balancer, a CDN, an API gateway) and it couldn't get a valid answer from the app. The proxy is fine; what's behind it isn't.
Common causes
- The application process crashed or isn't running.
- The app is restarting during a deploy.
- The proxy points at the wrong port or host.
- The upstream closed the connection or sent a malformed response.
How to fix 502
- Check that the app process is up and listening on the port the proxy expects.
- Look at the proxy's error log (for Nginx,
upstream prematurely closed connectionorconnect() failed). - Use rolling or zero-downtime deploys so a restart doesn't drop requests.
How Uptenna treats 502
With the default expected status (200-399), a 502 counts as a failed check. Two failures in a row open an incident, and the alert says Got HTTP 502 (expected 2xx or 3xx). The first successful check resolves it and sends a recovery.
See Monitors for expected status codes, keywords and timeouts.
Frequently asked questions
What does HTTP 502 mean?
502 Bad Gateway means a proxy or gateway got an invalid response, or no usable response, from the upstream server behind it.
Is 502 an error?
Yes, 502 is a server error: the problem is on the server's side (or something between the client and the server).
Does an uptime monitor treat 502 as down?
By default, yes: Uptenna counts anything outside 200-399 as a failed check and opens an incident after two failures in a row. You can change the expected status per monitor.
Related status codes
Find out the moment your site returns 502
Uptime checks, cron job heartbeats and a public status page, with an alert when something breaks. Free: 5 monitors checked every 5 minutes and email alerts. Pro ($9/month): checks every minute, Slack, Discord, Telegram and webhooks, SSL expiry warnings.
- No card required
- Status page included
- Email alerts included