502Bad Gateway
The server was acting as a gateway or proxy and received an invalid response from the upstream server.
What this code obliges you to do
Safe to retry
Repeating the same request can succeed, so a client may back off and try again. Honour Retry-After when the response sends one.
Not cacheable by default
Caches will not store this response unless you send explicit freshness headers saying they may.
Body allowed
You may return a payload explaining the outcome — for an error, a machine-readable problem document is worth the effort.
What usually causes it
2Nginx failing to connect to Node/PM2 backends
Docker container crash behind reverse proxy
Effect on search
Negative. Tells crawlers the proxy layer is alive but the underlying application servers are dead or inaccessible.
How to send it
1// Error typically thrown natively by Proxy/Load BalancersCodes people confuse with this one
3Internal Server Error
A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
Service Unavailable
The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
Gateway Timeout
The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.