DD
DevDash

HTTP 502 Bad Gateway: What It Means and When You See It

Quick Answer

HTTP 502 Bad Gateway means the server acting as a gateway received an invalid response from an upstream server. Often seen behind reverse proxies.

What HTTP 502 Means

HTTP 502 Bad Gateway means a proxy or gateway server received an invalid, incomplete, or unparseable response from an upstream server. Common in Nginx, AWS ALB, Cloudflare, and API gateways. The error is between the proxy and your backend - the client's request was valid. Common causes: the upstream server returned an invalid HTTP response, the app server crashed mid-response, or the upstream returned a non-HTTP response (port misconfiguration).

Debugging HTTP 502

Check if the upstream service is running: curl localhost:3000 (bypass the proxy). Check proxy error logs - Nginx logs the upstream address that returned the bad response. Common fixes: restart the app server (it may have crashed), check the upstream port and address in proxy config, verify the app is not returning a non-HTTP response on startup, and check for mismatched HTTP versions (proxy uses HTTP/2, upstream only speaks HTTP/1.1).

Try the interactive tool

Convert any value instantly — no sign-up required

Open tool →

Frequently Asked Questions

Related Values

Want API access + no ads? Pro coming soon.