502 Bad Gateway
5xx Server Error
RFC 9110
Your server's middleman got a garbage response from upstream.
What 502 Bad Gateway means {#what}
The server is acting as a gateway or proxy and received an invalid response from the upstream server. The problem is between your reverse proxy (Nginx, Caddy, etc.) and your application server — not between you and the proxy.
When you’ll see a 502 {#when}
- Your app server crashed while Nginx is still running
- Upstream service returned malformed response
- Misconfigured proxy
passdirective
When to fix a 502 {#fix}
- Check the upstream service (your app, API backend) — it’s likely down or crashing
- Check proxy configuration and upstream URL