What Is a 502 Bad Gateway Error?

A 502 Bad Gateway error happens when an edge server isn’t able to receive a response from the origin server (the server that has the information you want). This sounds a lot more complicated than it actually is.

Whenever you access a website, multiple servers that talk to each other back and forth. A 502 Bad Gateway error means there was a problem with the communication with one of the servers. Usually because a server is down.

As soon as these two servers have problems communicating, you’ll see the 502 Bad Gateway error. If you’re curious what you can do to fix or prevent this error and more about why you see it in the first place, we’ve got some answers.

Why am I seeing a 502 Bad Gateway error?

It’s true that you can run into the 502 Bad Gateway error on any browser and on any computer. It happens when there’s a communication error between servers or the server your computer is trying to reach just isn’t available.

There’s more than one reason you’re seeing a 502 Bad Gateway error. Most likely, it’s because the origin server your computer is communicating with is down completely. If this is the case, then your computer is unable to access information from this server. It could also mean the server is down temporarily.

Another reason could be that there’s a faulty firewall. Think of your firewall as a security system protecting your computer from harmful outsiders such as viruses, hackers, malware, and other dangers. Sometimes a faulty or overprotective firewall can make this error appear even when you’re accessing a site that’s safe.

It’s also possible that the domain name servers (that translate domain names into IP addresses) aren’t working. If this happens, you’ll receive the 502 Bad Gateway error and there’s really nothing you can do in this case.

How do I fix a 502 Bad Gateway error?

Here are some basic ways you can try fixing a 502 Bad Gateway error.

Reload the web page. Sometimes servers are having a hard time communicating and there’s a glitch somewhere. You can easily check if it was just a fluke issue by reloading the page. Make sure you wait at least a couple minutes after you see the error—sometimes there’s just a temporary problem with the origin server.

Clear your browser cache and cookies. Sometimes your browser can collect cookies and cache from websites you visit over time. When this happens, your computer can show errors and have problems connecting to servers. Clearing your cache will help you start fresh.

Check for server issues or connectivity issues. Many websites require multiple servers or even use third-party web hosts. If a website is having this error, it could be due to a connectivity issue. The best thing you can do in this case is to wait for the server to finish solving the problem and try accessing the website again at a different time.1

Figure out if there’s a DNS issue. As we talked about earlier, a DNS (domain name system) problem happens when the domain doesn’t resolve to the correct IP address. If you think this might be the problem, you can try what’s called “flushing” your DNS cache. It’s a lot like clearing your cache and cookies but more in depth.

Temporarily disable your firewall. Remember that a firewall is what protects your computer from viruses and malware. Sometimes your firewall is overreacting to a site that’s actually safe. If you use a third-party firewall, try temporarily disabling it to see if that solves the 502 Bad Gateway error.2 If the error goes away, you’ll know your firewall just didn’t like the website you were trying to access.

Now that you know, here are your next steps.

Time for a new internet provider? Find one near you.

Keep your internet access and browsing private.


Additional reading:


1. Clifford Chi, “A Simple Explanation of a 502 Bad Gateway Error & How to Resolve It,” June 18, 2019. Accessed November 6, 2020.
2. Brain Jackson, “How to Fix a 502 Bad Gateway Error on Your WordPress Site,” November 1, 2020. Accessed November 6, 2020.