HTTP Status Codes

502 Bad Gateway

A gateway or proxy received an invalid or empty response from the upstream server it was forwarding to. Common at CDNs and load balancers when the origin is unhealthy.

What it means

502 Bad Gateway is emitted by an intermediary — CDN, reverse proxy, load balancer — when the upstream returns something invalid, closes the connection, or crashes mid-response. The fault is between the gateway and the origin, not with the client.

Why it matters

  • It localises the failure to the origin behind a proxy, guiding where to look.
  • It is one of the most common symptoms of a crashed or overloaded backend.

Common mistakes

  • Assuming a 502 is a client problem; it is an upstream/origin issue.
  • Origin timeouts shorter than the work they perform, so the proxy gives up and returns 502.

How WebInspect checks this

  • WebInspect flags 5xx responses and reports the server/CDN chain and timings that surround a 502.