HTTP status code 502 — Bad Gateway

Quick answer

Status code 502 (Bad Gateway): Upstream server returned an invalid response. Proxy/CDN/load balancer could not get a valid answer from origin.

Proxy/CDN/load balancer could not get a valid answer from origin.

502 points at the hop between proxy and origin. Check origin health, TLS, and upstream timeouts.

Common causes

How to fix it

Check whether the origin server/process is actually up — this is almost always an infrastructure issue, not something a client retry fixes.

All HTTP status codesJSON Formatter

Related: 503500504451429

Frequently asked questions

What is status code 502?

502 Bad Gateway: Upstream server returned an invalid response. Proxy/CDN/load balancer could not get a valid answer from origin.

When should I expect HTTP 502?

502 points at the hop between proxy and origin. Check origin health, TLS, and upstream timeouts.

What usually causes HTTP 502?

The origin server crashed or is not running; A misconfigured reverse proxy pointing at the wrong host/port; A TLS handshake failure between proxy and origin.

How do I fix HTTP 502?

Check whether the origin server/process is actually up — this is almost always an infrastructure issue, not something a client retry fixes.

Where can I see all status codes?

Open the HTTP status codes hub on TryDevSnip for the full reference list.

Does TryDevSnip log my API traffic?

No. These pages are static reference. TryDevSnip does not proxy or inspect your HTTP calls.

TryDevSnip