// http 5xx · server error

HTTP 502 Bad Gateway

An upstream server returned an invalid response.

What HTTP 502 Bad Gateway means

502 Bad Gateway means a server acting as a proxy or gateway got an invalid response from the upstream server it relies on. The immediate server is fine; something behind it failed.

Which category is it?

502 is a 5xx code — Server error. 5xx means the server failed to fulfil an apparently valid request. It's the server's responsibility, not the caller's.

Common causes

  • The upstream/origin server is down or crashed
  • A misconfigured reverse proxy or load balancer
  • The upstream returned a malformed response

How to fix it

  • Check the health of the upstream service
  • Verify proxy/load-balancer configuration
  • Restart or redeploy the failing origin server

Other server error (5xx) codes