HTTP Errors

What Is the 502 Status Code? (Bad Gateway)

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 code502
MeaningBad Gateway
Category5xx Server Error
Common causes (scraping)Flaky proxy, overloaded/down origin, CDN can't reach backend
Right responseFix the request / retry with backoff; for disguised blocks use a real-browser unblock

What a 502 Bad Gateway means

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. In short, 502 status code is a gateway or proxy got an invalid response from the upstream server.

Why scrapers see 502

When scraping you see 502 from flaky proxies, an overloaded origin, or a CDN that can't reach the backend. It can also appear transiently when an anti-bot edge mishandles or drops a suspicious request. Unlike a 403, a 502 is generally worth retrying.

How to fix a 502 error

Retry with exponential backoff and jitter — most 502s clear on their own. If they persist, the gateway between you and the origin is the problem: swap to a more reliable proxy pool, lower concurrency so you're not overwhelming a fragile origin, and check whether your proxy provider (not the target) is returning the 502. Persistent 502s only on protected URLs can mean an edge dropping you — a real-browser unblock flow via Web Unblocker is more stable.

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.

0 terms · 0 connections
You are here · HTTP Errors
Building map…

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