A gateway or proxy got an invalid response from the server behind it — a crash, a closed connection, garbage instead of HTTP.
Defined in RFC 9110 §15.6.3 — 502 Bad Gateway · MDN reference
Load balancers and reverse proxies (nginx, a cloud load balancer, a CDN) in front of an application that crashed, restarted, ran out of memory or closed the connection mid-response.
The upstream failure your monitoring confuses with your own. Test that clients retry idempotent requests with backoff, and that error pages do not blame the user.
Retry idempotent requests with exponential backoff; a 502 is often transient during deploys. For writes, retry only with an idempotency key — the upstream may have processed the request before failing.
1 endpoint in this playground answers with 502. Every one is free, needs no signup, and can be called from the browser or with curl.
GET https://funapi.dev/api/faults/v1/status/{code} — Return any status code on demand (200–599) (Fault Injection API) Open & run this endpointAll HTTP status codes · All 39 mock REST APIs · Getting started guide
Last updated