BCDRPulse

Down Checker / Error codes

502 Bad Gateway

A proxy, load balancer or CDN in front of the site asked the application for the page and got an invalid answer, or none: the connection was refused or reset, or the response was malformed.

Where it failed: a proxy or load balancer

What visitors see

A "502 Bad Gateway" page, often styled by the proxy (nginx, a load balancer, a CDN).

Usual causes

  • The application process is down or restarting (PHP-FPM, Node, Gunicorn, Puma crashed or is being redeployed).
  • The proxy points at the wrong port or socket.
  • The application ran out of workers or memory and refuses new connections.
  • A firewall between the proxy and the application blocks the connection.

How to tell which one it is

  • 502 means the proxy reached the application and got nothing usable; 504 means it waited and gave up; 503 means something is refusing work on purpose.
  • The proxy's own error log says which: "connect() failed (111: Connection refused)" or "upstream prematurely closed connection" (nginx).

What to do

  1. Check the application process is running (systemctl status php8.3-fpm, pm2 status, docker ps) and restart it.
  2. Compare the proxy's upstream address (proxy_pass, fastcgi_pass) with the port or socket the application listens on.
  3. Raise the worker count or memory limit if the application keeps running out.
  4. Behind Cloudflare, a 502 page with Cloudflare branding can also come from Cloudflare itself; check the error page names the failing side.

Check the site now

The Down Checker names the layer that failed (DNS, connection, TLS or the server) and decodes the error page it gets.

Free, no sign-up. Scan only sites you own or may test. 60 scans an hour per address.

Related codes