How to use it
- Enter the address of the page that shows 502.
- If our check also gets an error, the site is down: wait and try again later.
- If our check gets 200 but you still see 502, follow the fixes for visitors below.
What 502 Bad Gateway means
Most large websites do not answer you directly. Your request first reaches a gateway: a reverse proxy such as nginx, a load balancer, or a CDN such as Cloudflare. The gateway forwards the request to the application server, called the upstream or origin, and passes the answer back to you.
A 502 Bad Gateway means the gateway did reach the upstream, but the answer it got back was not a valid HTTP response. The MDN definition puts it this way: the server was acting as a gateway or proxy and received an invalid response from the upstream server. If the upstream had sent a normal error, such as a 500, the gateway should pass that error on instead. If the upstream sent nothing in time, the gateway returns a 504 Gateway Timeout instead.
Common causes
| Cause | What happens | Who can fix it |
|---|---|---|
| Application crashed or restarting | The proxy connects, but the process behind it dies or closes the connection mid-answer. | Site owner |
| Deploy in progress | Old workers stop before new ones are ready, so a few requests hit nothing. | Site owner, often fixes itself in minutes |
| Overload | Too many requests, so workers run out of memory or connections and drop requests. | Site owner |
| Wrong proxy setup | The proxy points at the wrong port or address, or the upstream speaks a different protocol than expected. | Site owner |
| Firewall blocks the CDN | The origin rejects the CDN's addresses, so the CDN cannot get a proper answer. | Site owner |
| Your VPN, proxy or DNS | Your own network path sends the request through a gateway that fails. | You |
MDN notes that most 502 errors need the server owner to investigate. The exceptions are client network problems, especially when the site works for other people and you use a VPN or a custom network setup. In that case MDN suggests checking network settings, the firewall, proxy settings and DNS configuration.
Down for everyone, or only for you?
The check at the top of this page loads the address from our servers, outside your home or office network. Read the result like this:
- Our check also gets 502, 503 or 504: the site has a server problem. Nothing on your device will fix it. Wait a few minutes and check again.
- Our check gets 200 but you see 502: the site works. Something between you and the site fails, most likely a VPN, a company proxy, a browser extension or a cached error.
- Our check cannot connect: the site is fully down or blocks data centers. Look for the official status page of the service.
Fixes for visitors
- Reload once after a minute. Many 502 pages come from a short restart. Avoid pressing reload again and again, because extra traffic does not help an overloaded server.
- Open the page in a private window. This skips most extensions and the normal cache. If the page works there, clear the cache and cookies for that site.
- Turn off your VPN or proxy. Then reload. If the page loads, the VPN exit server or the proxy was the broken gateway.
- Try another network. Switch your phone from Wi-Fi to mobile data. If it works there, restart your router.
- Flush your DNS cache. An old DNS answer can send you to a server that no longer serves the site. See how to flush DNS on your system.
Fixes for site owners
Start with the error log of the proxy, because it states why the upstream answer was rejected: connection refused, connection reset, or an invalid header. Then look at the application log for the same minute. Check that the application process runs and listens on the port the proxy expects, that it did not run out of memory, and that the last deploy finished. Behind a CDN, confirm that your firewall allows the CDN's address ranges and that the origin answers when you request it directly. When it works again, confirm from the outside with the website down checker, because your own browser may keep showing the old error.
Related errors
503 Service Unavailable means the server is up but refuses work for now, usually from maintenance or overload. A browser message such as This site can't be reached means your browser never got any HTTP answer at all. For all codes in one table, see HTTP status codes explained.
Frequently asked questions
Is a 502 Bad Gateway my fault?
Usually not. A 502 is produced by a server that sits in front of the website, such as a proxy, a load balancer or a CDN, when the server behind it gives a broken answer. If the same page also fails from our check, the problem is on the site. If it fails only for you, look at your VPN, proxy or DNS settings.
How long does a 502 error last?
There is no fixed time. Many 502 pages come from a restart or a deploy and disappear within minutes. If the application behind the proxy keeps crashing, the error stays until the owner fixes it. Run a new check every few minutes instead of reloading constantly.
What is the difference between 502 and 504?
Both come from a gateway. A 502 means the gateway got an invalid response from the server behind it. A 504 means the gateway got no response at all within its time limit.
Does clearing the cache fix a 502?
Only when your browser shows an old error page from its cache, which is rare because error pages should not be cached. Try a private window first. If the private window shows the site, clear the cache for that site.
Why does the 502 page show the Cloudflare or nginx name?
The page is made by the gateway, so it often carries the name of the software or service that runs it. It tells you who reported the error, not who caused it. With Cloudflare, the fault is usually on the site's own server behind it.
Can a 502 hurt a website in Google?
A short 502 does not. Google treats 5xx errors as temporary and retries later. If pages return 5xx for a long time, crawling slows down and the pages can drop out of the index, so owners should fix long outages quickly.