502 Bad Gateway: What Is It and How to Fix It

4.5 min. read

502 Bad Gateway error is a common HTTP status code that can happen in all browsers and all devices. Learn what it means and how you can fix it.

Every time your site experiences an error, you immediately turn into Sherlock Holmes. You try to investigate what exactly happened and why.

Now you're faced with another issue - 502 Bad Gateway error. You check your internet connection, and it seems to be working fine. You take a look at your computer, but there's nothing wrong with it.

So, why are you experiencing and how can you fix a 502 Bad Gateway error?


What Does 502 Bad Gateway Mean?

Every time you try to open a page, you're sending a request to a web server to access that page. The web server receives and processes your request and sends back the resource you requested together with an HTTP header and HTTP status code.

There's a range of different 500 status error codes, including 500, 501, 502, 503, 504, 505, 508, 510, and more. These 500 status codes indicate that it's a server error. They are no fault of the client, meaning the request you made was good, but the server can not generate the requested resource.

The 502 Bad Gateway error specifically indicates that one server on the internet received an invalid response from another server.

How Can the 502 Bad Gateway Error Appear?

There are various web servers, operating systems, and browsers in use. For example, you might be using a Google Chrome browser and MacOS. Another person, on the other hand, might be using Firefox and Windows 10 OS.


What's more, some websites can customize the way the 502 Bad Gateway error is presented to users.


However, these variations all have the same meaning. One server that was acting as a gateway or proxy has received an invalid response from an inbound server.


The most common ways you might see it include:


  • 502 Bad Gateway

  • Error 502

  • 502 Server Error: The server encountered a temporary error and could not complete your request

  • Temporary Error (502)

  • 502. That's an error

  • HTTP 502

  • 502 Service Temporarily Overloaded

  • 502 Proxy Error

  • HTTP Error 502 - Bad Gateway

  • 502 bad gateway Cloudflare

Other platforms and services can have other ways of displaying the error. For example, Twitter shows an entirely different message that says: "Twitter is over capacity."
Google also displays it differently. If you experience the error while using their browser, you'll see a message that reads:  “502. That’s an error. The server encountered a temporary error and could not complete your request. Please try again in 30 seconds. That’s all we know.”

How Can You Fix a 502 Bad Gateway?

Although in most cases, a 502 Bad Gateway error is a server-side error, it can also be a client issue. So if you come across a 502 Bad Gateway error, don't get frustrated. There are ways to fix it. Here's how:

Reload the page

The first thing - and the easiest - you should do is try reloading the page. Wait one minute and reload the URL by clicking the refresh/reload button. Or, you can press F5 or Ctrl+R on your keyboard. If the issue gets resolved, then it might have been a temporary connection problem.


If you still see a 502 error, clear your browser cache and then reload the page once again.


In case none of these things work, try some of the tips below.


Close all open browser windows and start a new session

Another easy thing to try is to start a new browser session. Close your open browser windows and open a new one. Then try to open the page again.

Clear your browser cache

Have you been thinking about clearing your browser cache but never found the time? Well, now it's a great time to do so!


Why?


Because in some cases, corrupted or outdated files stored in your browser might be the cause of a 502 Bad Gateway error.


What you should do is clear your cache and try loading the page again. If your browser cache was the problem, this would solve the issue.


Don't know how to clear your cache? Here are instructions on how to do it in various browsers.

Start your browser in Safe Mode

Using a browser in Safe Mode means to use it with disabled extensions and without add-ons. In this mode, the browser will delete your cookies, searches, and history at the end of the session.


So, whether you're using Chrome, Firefox, or Internet Explorer, enter the Safe Mode and reload your page. If the 502 Bad Gateway error no longer appears, it means that some browser extension or setting is the cause of the issue. In this case, you should go to your browser settings and selectively disable browser extensions to find the one that's causing the issue.


Apart from extensions, another cause might be a plugin. To see whether a plugin is the root of the problem,  enable your plugins one by one to find the culprit.


Try another browser

If using your browser in Safe Mode didn't help, try using a different one. For example, if you're using Chrome, try accessing the page in Internet Explorer. If the other browser doesn't show you a 502 Bad Gateway error, then your original browser has been causing the issue. In this case, try deleting and reinstalling your browser and see what happens.

Restart your device and networking equipment

There's always the possibility that your device might be experiencing temporary issues. If you're seeing the same error on multiple sites, then this is probably the case.


In this case, a restart would help.


Also, it's not excluded that your modem, router, or other networking devices are the source of the problem. Restart your networking devices and try loading the page.


Change your DNS Servers

Sometimes, 502 Bad Gateway errors are caused by DNS problems. Although this happens rarely, it wouldn't hurt to try.


Your DNS servers are most likely set by your ISP. You can easily change them to a third-party DNS server like Google DNS or OpenDNS.


If you've never changed your DNS settings before, here are instructions on how to do it.

Contact your host

Most websites are maintained active by third-party hosting providers. One reason for the 502 Bad Gateway error might be that the server is down for maintenance. Make sure you contact your host to find out.


It's always a good idea to get in touch with your host as they will be able to look deeper into what's causing the issue. If they discover that the problem is on their end, then they might be able to fix it quickly. Or, if something's wrong on your end, they can walk you step-by-step through the solution.


Other HTTP Status Codes Similar to 502 Bad Gateway

Your website can come across many different errors in its lifetime. For example, you'll likely need to use a 301 Moved Permanently or experience a 404 error. When this happens, you want to be prepared.


To help you understand the different types of status codes and their meaning, we've put together a comprehensive HTTP status codes cheat sheet. Hopefully, you'll use it to quickly reference codes and determine what each type of error implies and how you can fix it.


Finally, don't forget to regularly perform monthly website maintenance to detect errors faster and resolve them on time.

Share:

As seen in  

&