502 Bad Gateway means a server acting as a gateway or proxy, such as nginx, a load balancer or a CDN, got an invalid response or no response from the upstream server behind it.
HTTP/1.1 502 Bad GatewayCommon causes
- The application server crashed, is restarting or is not listening on the expected port.
- The proxy points at the wrong upstream address.
- The upstream closed the connection or sent a malformed response.
How to fix it
- Check that the application process is running and reachable from the proxy.
- Read the proxy's error log (for nginx, error.log shows 'connect() failed' or 'upstream prematurely closed').
- As a visitor, wait a moment and reload: 502s during deploys usually clear quickly.