502
5xx Server ErrorBad Gateway
The server, acting as a gateway, got an invalid response upstream.
502 Bad Gateway means a server acting as a proxy or gateway (nginx, a load balancer, a CDN) got a broken or empty response from the upstream server it forwards to. The proxy is fine - whatever it talks to is down, crashed, or returned garbage. Look at the upstream app, not the proxy.
About 5xx Server Error
The server failed to fulfill a valid request. The problem is on the server side, not the client.
How to fix 502 Bad Gateway
- Check whether the upstream app or service is actually running.
- Look at the upstream logs for a crash or out-of-memory kill.
- Verify the proxy points at the right host and port.
- If upstream is slow to boot, give it time or add a health check.