Glossary

HTTP 502 Bad Gateway (HTTP 502 Bad Gateway)

HTTP 502 Bad Gateway indicates that a server acting as a gateway or proxy received an invalid upstream response. The status locates a failure relationship, but does not by itself identify which intermediary in a multi-hop path generated it.

Explanation

The upstream depends on the responding node

A client-side proxy may have a destination upstream, while a website reverse proxy has an application backend upstream. MDN defines 502 in terms of a gateway or proxy receiving an invalid response. The same status can therefore describe failures at different points along the request path.

Keep it separate from authentication and waiting

A 407 concerns proxy authentication. A 504 concerns a gateway not receiving a timely upstream response. Do not collapse all three into an “IP blocked” label. A correctly formed error response from an origin should not automatically be reclassified as an invalid upstream response.

An evidence-based diagnosis

In an illustrative authorized API test, preserve the request time, response headers, sanitized body and any request identifier. Note whether failure occurred during tunnel setup or after reaching the website. Correlate the record with the relevant service logs when available; a branded error page is a clue, not a complete root-cause analysis.

Retry decisions still need application context

Changing proxies may leave a destination backend problem untouched. Before retrying an operation with side effects, establish whether it may already have been processed and what recovery mechanism the application provides. For read-only checks, use bounded retries under the service’s rules rather than treating repeated attempts as a repair.

Related concepts

References

Sources checked on November 19, 2026. Examples illustrate concepts and are not proxy-service measurements.

Frequently Asked Questions

QDoes 502 prove the proxy password is wrong?
A

No. Proxy authentication has its own mechanism, commonly 407 for HTTP. Diagnose the actual stage and responding component.

QDoes it prove the destination blocked the exit IP?
A

No. The status definition does not establish that cause. Logs and response context are needed.

QShould every 502 trigger a new proxy purchase?
A

No. First locate the failing intermediary or upstream. A destination-side failure may be independent of the selected exit.

Further Reading
Continue with the latest news and practical guides.