What does 502 Bad Gateway mean?
A gateway or proxy (nginx, load balancer, Cloudflare) could not get a valid response from the application server behind it.
Common causes
- App server crashed or is restarting
- Wrong upstream port
- Upstream closed the connection
How to fix it
- Check the app is running and listening
- Check proxy upstream config
- Look at app logs at the same time
502 and webhooks
Retried by providers. Common right after a deploy.
Test how your client handles 502
In the webhook tester you can add a response rule that answers 502 — useful to check retries, error handling and alerts before production.
FAQ
What does HTTP 502 mean?
A proxy got an invalid response from upstream. A gateway or proxy (nginx, load balancer, Cloudflare) could not get a valid response from the application server behind it.
Is 502 an error?
Yes — a server error: the request may succeed if retried later.
Other 5xx codes
500 Internal Server Error · 501 Not Implemented · 503 Service Unavailable · 504 Gateway Timeout · 505 HTTP Version Not Supported · 507 Insufficient Storage · 508 Loop Detected · 511 Network Authentication Required · 520 Web Server Returned an Unknown Error · 521 Web Server Is Down · 522 Connection Timed Out · 523 Origin Is Unreachable · 524 A Timeout Occurred · 525 SSL Handshake Failed · 526 Invalid SSL Certificate