Skip to content
GGleamInsight
Wiki

HTTP 502 Bad Gateway

HTTP 502 Bad Gateway means a server acting as a gateway or proxy received an invalid response from an upstream server while handling the request. It identifies a gateway-stage failure, not a specific defective exit IP.

Published 2 min readUpdated

Definition

HTTP 502 Bad Gateway means a server acting as a gateway or proxy received an invalid response from an upstream server while handling the request. It identifies a gateway-stage failure, not a specific defective exit IP.

Understand upstream relative to the sender

Upstream is the next system the responding intermediary contacted to fulfill the request. In a proxy chain, more than one intermediary can have an upstream. The destination’s own reverse proxy can generate 502 even when the client’s forward proxy is working.

MDN explains that a valid HTTP error response from an origin should generally be passed through rather than replaced with 502. The key distinction is the gateway’s difficulty obtaining a valid upstream response, not merely that the origin returned a non-success status.

Compare the neighboring errors

A 407 asks for proxy authentication. A 403 communicates refusal. A 504 reports that a gateway did not receive an upstream response in time. These observations guide different investigations and should not be grouped under one generic proxy failure label.

For an illustrative request path from a client through an outbound proxy to a website gateway, record which system’s response details are available. The error code cannot on its own show which of those gateways produced it.

Choose a limited next step

For a safe, authorized read, a later bounded retry may be reasonable when the failure appears temporary. For an operation with uncertain side effects, check its outcome or documented idempotency behavior before repeating it.

If the failure persists, provide the responsible operator with the request time, destination, and redacted response details. Record whether other permitted destinations work through the same configuration. This can narrow the scope without assuming that every exit or every upstream is affected.

Sources

Sources checked on November 18, 2026. Examples are illustrative, not measurements of a live proxy service.

Frequently asked questions

Does 502 always come from my proxy provider?

No. It can come from another gateway, including one operated by the destination.

Is 502 an authentication error?

Not by definition. HTTP proxy authentication uses 407; inspect the actual response and path.

Should I immediately retry a failed transaction?

Not solely because it returned 502. Establish whether repeating the operation is safe or check the prior outcome.