Bad Gateway — the server received an invalid response from an upstream server
What 502 Means
The 502 error on the HTTP Status-Codes indicates bad gateway — the server received an invalid response from an upstream server. This typically occurs due to upstream application server is down or not responding.
A 500 error means your application itself crashed. A 502 error means your reverse proxy (like Nginx) could not get a valid response from the application server behind it — often because the app is down or took too long to respond.
Common Causes
- Upstream application server is down or not responding
- Reverse proxy (Nginx/Apache) timeout while waiting for the application
- Firewall blocking communication between proxy and application
- DNS resolution failure for the upstream server
Frequently Asked Questions
Common questions about HTTP 502 error
A 500 error means your application itself crashed. A 502 error means your reverse proxy (like Nginx) could not get a valid response from the application server behind it — often because the app is down or took too long to respond.