502
HTTPSERVER_ERRORCritical5xx Server ErrorHIGH confidence

Bad Gateway

Production Risk

High. It indicates a critical failure in the application stack. The website or application is likely completely unavailable to users.

What this means

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.

Why it happens
  1. 1A reverse proxy (like Nginx) cannot reach the upstream application server (e.g., a Node.js or Python app).
  2. 2The application server crashed or is not running.
  3. 3A firewall is blocking communication between the proxy and the application server.
  4. 4The application server sent back a response that the gateway could not understand.
How to reproduce

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.

trigger — this will error
trigger — this will error
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.

Check Upstream Service Status
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.

Check Network Connectivity
ping <upstream_server_ip>

Why this works

Network Diagnostics

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All HTTP errors