[38;5;215m[1m@[0m[1mhttp[0m [2m· HTTP status codes, explained[0m [38;5;203m[1mHTTP/1.1 502 Bad Gateway[0m [38;5;203m━━━━━━━━━━━━━━━━━━━━━━━━[0m [2m5xx · Server error[0m A proxy got an invalid response from upstream. [38;5;203m[1mWHAT IT MEANS[0m [2m────────────────────────────────────────────────────────────[0m A gateway or proxy, such as nginx, a load balancer or a CDN, got an invalid response from the server behind it, or no response at all. The proxy itself is fine; the problem is upstream. [38;5;203m[1mWHY YOU'RE SEEING IT[0m [2m─────────────────────────────────────────────────────[0m [38;5;203m→[0m The app server crashed, restarted or isn't running. [38;5;203m→[0m The proxy points to the wrong host or port. [38;5;203m→[0m The upstream closed the connection early or sent malformed headers. [38;5;203m→[0m TLS problems between the proxy and the origin. [38;5;203m[1mHOW TO FIX IT[0m [2m────────────────────────────────────────────────────────────[0m [38;5;203m→[0m Check that the upstream is running and reachable from the proxy. [38;5;203m→[0m Read the proxy's error log; nginx says why, e.g. "connection refused" or "upstream prematurely closed". [38;5;203m→[0m Clients can retry with backoff, since 502s are often brief during deploys. [38;5;203m[1mEXAMPLE RESPONSE[0m [2m─────────────────────────────────────────────────────────[0m [38;5;203mHTTP/1.1 502 Bad Gateway[0m [2mContent-Type: text/html[0m [2m[0m [2m