On this page
HTTP 502 Bad Gateway means a gateway or proxy got an invalid response from the upstream server. A server acting as a gateway or proxy received an invalid response from the upstream server it tried to reach. It's a server-side failure between the edge and the origin — and being a 5xx, it's usually temporary. It's also written “HTTP 502” or just “502 error” / “502 status code.”
Quick facts
| Status code | 502 |
|---|---|
| Meaning | Bad Gateway |
| Category | 5xx Server Error |
| Common causes (scraping) | Flaky proxy, overloaded/down origin, CDN can't reach backend |
| Right response | Fix the request / retry with backoff; for disguised blocks use a real-browser unblock |
Related terms
Concept map
How 502 Status Code (502 Bad Gateway) connects
The terms most directly tied to this one. Hover a node to see its neighbours, click to preview, drag to rearrange.
Tools & solutions for this topic
Frequently asked questions
Is 502 a client or server error?
It's a server-side (5xx) error — the problem is between servers, not in your request.
Does a 502 mean I'm blocked when scraping?
Not usually — 502 is typically transient/server-side, though it can coincide with edge blocking.
How do I fix a 502 error?
A gateway or proxy got an invalid response from the upstream server is the cause, so the fix targets that. Retry with backoff and use reliable infrastructure.
What's the difference between 502 and 503?
502 Bad Gateway means an upstream returned a broken response to a gateway. 503 Service Unavailable means the server itself is up but temporarily can't handle the request (overload/maintenance). Both are 5xx and usually transient.
Last updated: 2026-05-28