502 Bad Gateway: what it means and what to do

Updated 15 October 2026 · Site Down Right Now

Big websites rarely serve pages from a single machine. Your request first reaches a gateway, such as a load balancer, CDN or reverse proxy, which passes it to the server that builds the page. A 502 Bad Gateway means the gateway got an invalid response, or none at all, from that server.

In almost every case the problem is on the website's side, and it often clears within minutes.

What you can do as a visitor

  1. Wait a minute and reload. 502s often appear while a site restarts or deploys an update.
  2. Check whether it's down for everyone with our website checker, or look up the service in our list of status pages.
  3. Clear your cache or try Incognito mode in case your browser saved the error page.
  4. Try another browser, device or network. Rarely, a VPN or proxy in the middle causes a 502.

If the 502 continues on every device, the website has an outage and there's nothing more you can do except wait.

If you run the website

  • Check that your application server (for example PHP-FPM, Node.js, Gunicorn or Puma) is running and hasn't crashed or run out of memory.
  • Read the proxy's error log (Nginx: error.log), which usually names the failing upstream.
  • Make sure the proxy points at the right host and port, and that a firewall isn't blocking it.
  • Look for responses that are too large or malformed, and for workers being killed by timeouts.
  • If you use a CDN such as Cloudflare, check whether the error page is branded by the CDN (problem reaching your server) or by your own server.

Questions

Is a 502 Bad Gateway my fault?

Almost never. It's a server-side error between the website's own systems. Reloading or waiting is usually all you can do.

How long does a 502 error last?

Most clear within a few minutes, during a restart or deployment. If it lasts longer, the website is having an outage.

What's the difference between 502, 503 and 504?

502: the gateway got a bad response from the server behind it. 503: the server is temporarily unavailable, often overloaded or in maintenance. 504: the server behind the gateway took too long to respond.