502
Bad Gateway
The server acting as a gateway or proxy received an invalid response from the upstream server. The reverse proxy (nginx, Cloudflare, a load balancer) is working, but the backend application server returned something it could not understand.
What does HTTP 502 mean?
The server acting as a gateway or proxy received an invalid response from the upstream server. The reverse proxy (nginx, Cloudflare, a load balancer) is working, but the backend application server returned something it could not understand.
Common causes
- 1
The upstream application server crashed or is not running. The proxy can reach the port but gets a malformed or empty response.
- 2
The application server returned a response with invalid HTTP headers or a corrupted body that the proxy cannot parse.
- 3
A firewall, security group, or network issue between the proxy and the upstream server is mangling or dropping packets.
How to fix it
- 1
Check if the upstream application server is running: verify the process, check its logs, and confirm it is listening on the expected port.
- 2
Restart the application server. If it crashed due to an out-of-memory error, check resource usage and increase memory limits.
- 3
Review the proxy configuration. Ensure proxy_pass (nginx) or upstream settings point to the correct host and port. Check for protocol mismatches (HTTP vs HTTPS).
Monitor for HTTP 502 errors
A 502 usually means your app server is down while the proxy layer is still healthy. Uptrack detects this within 30 seconds — much faster than waiting for user complaints. Pair Uptrack with server resource monitoring for full coverage.
Catch HTTP errors before your users do
20 monitors free — 10 at 30s, 10 at 1min. No credit card required.
Start Monitoring Free