Bad Gateway
Production Risk
High. It indicates a critical failure in the application stack. The website or application is likely completely unavailable to users.
The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request. This means an upstream service is down or not working correctly.
- 1A reverse proxy (like Nginx) cannot reach the upstream application server (e.g., a Node.js or Python app).
- 2The application server crashed or is not running.
- 3A firewall is blocking communication between the proxy and the application server.
- 4The application server sent back a response that the gateway could not understand.
A user tries to access a website, but the application server that generates the pages has crashed, so the web server (gateway) cannot get a response.
GET /index.html HTTP/1.1 Host: example.com
expected output
HTTP/1.1 502 Bad Gateway
Fix 1
Check Upstream Service Status
WHEN You are the server administrator.
systemctl status my-app.service # or check logs for the upstream application
Why this works
Server Administration
Fix 2
Check Network Connectivity
WHEN The gateway and upstream are on different machines.
ping <upstream_server_ip>
Why this works
Network Diagnostics
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev