Back to Directory
502

502 Bad Gateway

The server received an invalid response from an inbound server it was accessing while acting as a gateway or proxy.

What it means

One server (the gateway/proxy) tried to talk to another server (the upstream) and got a bad response.

Why it happens

  • The upstream server (e.g., PHP-FPM, Node.js) is down or restarting.
  • Firewall blocks the request between servers.
  • Server overload/timeout.
  • CDN issues (Cloudflare errors).

How to fix it

Step 1
Restart your web server (Nginx/Apache) and application server (PHP/Node).
Step 2
Check firewall rules and IP restrictions.
Step 3
Disable your CDN temporarily to see if it's the cause.
Step 4
Check for high CPU/RAM usage on the upstream server.

Monitor 502 Errors

Don't let your users see this error before you do. Statzly can alert you instantly when your server returns a 502.

Alert Me on 502

Free forever. No credit card required.