Status codes · one code502 — Bad Gateway
What a 502 Bad Gateway response means, who is at fault, what a visitor should do and what the server owner should do.
Open the reference on this codeWhat to do
If it is someone else's site
There is nothing to do from outside: the site is up but its inner part is unreachable. That usually lasts minutes — the time a restart takes — so retrying a little later makes sense.
If it is your server
Check three things in order: whether the application process is alive, which address it listens on, and whether that address matches proxy_pass. The classic cases: the app crashed after a deploy; the port was still held by the previous process and the new one came up next door; in Docker the service is reachable by container name while the config says 127.0.0.1. If the process is alive and the port is right yet the 502 persists, look at 504 instead: that one is about timeouts.
Easily confused with
the connection was made but no answer arrived: the upstream is alive and slow.
504 →the application did answer — with an error. So it is running, and the problem is in the code.
500 →the upstream is absent on purpose: maintenance or a node taken out by the balancer.
503 →How to check
whether anything listens on the port proxy_pass aims at
whether the upstream answers directly, bypassing the proxy
The reference holds sixty-four codes searchable by number, name and meaning — plus a breakdown of confusing pairs such as 401 and 403.
Updated