If you’ve been browsing the web for a while, you might have observed the 502 bad gateway error sometime. Fret not, we will help you to understand, analyze and potentially fix the 502 bad gateway error.

What Is A 502 Bad Gateway Error?

502 Bad Gateway Error” is an HTTP status code that tells you that something’s wrong with the website/web service you are trying to access or visit.

Specifically, the 502 bad gateway error means that the proxy server received an invalid response from the origin server (or the upstream server).

In other words, the web service (or the site) that you try to access resides on a web server – but they further utilize a proxy server or a service like Cloudflare to protect their original server. “Proxy” means intermediary here.

Browser <==> Proxy <= issue => Website

How To Identify A 502 Bad Gateway Error?

It is pretty self-explanatory – but you just have to look at the error code “502“. You might observe creative texts/pages for the error but the number (or code) will help you identify the error.

You might be able to fix the error – but only if it is an issue from your end (your PC, browser, OS, etc).

So, before trying to fix the error, we can analyze the issue to make sure that it is not a problem from their end (the website you are trying to visit).

Analyze The 502 Bad Gateway Error

It is quite easy to utilize some of the online tools available to check whether the issue persists for you alone or if there’s a fault in the web server of the website.

1. Use Google PageSpeed Insights

pagespeed insights

Google’s PageSpeed Insights is a tool meant for web developers to check the performance of their website and make changes accordingly.

Basically, it acts as a remote computer for you to load up a webpage and see if it is working (that is how we are going to use it here).

If the URL you entered works completely fine using the PageSpeed Insights, you will observe a speed score of the website along with a snapshot of the website (how it looks like when it loads up).

If everything looks fine – you need to fix something from your end. In other words, you will have to try the solutions mentioned in the later section of this article to resolve it.

2. Open A Private / Incognito Tab (or Try Another Browser)

No matter what browser you are using – simply switch to the private browsing mode (or the incognito mode) to ignore the cache/cookies stored on your browser and try to access the website.

If you can access the website then it is probably a caching issue, which can be easily fixed. If you still get the same error, you should try loading up the website using another browser (suppose you are using Mozilla Firefox, try using Google Chrome to access the issue).

Potential Cause Of Bad Gateway Errors

  • For Web Developers: If you are a website administrator, you need to know what is causing the error in the first place. In this case, either your origin server is down or your domain name hasn’t been pointed to the correct IP address. Also, if you’ve made changes to your firewall, you would want to check that as well.
  • For Visitors: If you are just a reader/customer trying to access a website, the issues could be associated with your browser, network, or the DNS servers.

Solutions To Solve a 502 Error (Bad Gateway)

Do note that these solutions are intended for visitors only. If you are a web developer or an administrator of a web server, you have to check your origin server configuration and troubleshoot the issue.

1. Reload The Webpage

This sounds ridiculous but sometimes the error is temporary and simple reload helps you access the website without any issues. So, you need to try doing that first. Press F5 on PC, and Cmd + Shift + R to hard-refresh on Mac.

2. Clear Cache/Cookies Of Your Browser

You can refer to our guide on how to clear browsing data on Chrome, Firefox, and Edge to easily clear cache/cookies. Once, you’ve cleared it, try reloading the webpage again. As mentioned above, you can simply launch a new incognito browser tab, which is like a fresh browser.

3. Change DNS Server

If the above two solutions do not work, you can simply try to change your DNS server. You can either choose to change the DNS on your router or on your Windows machine.

4. Use A VPN

If your ISP (Internet Service Provider) is at fault, you can try using a VPN and then access the website to see if it works.

5. Get Rid Of Unnecessary Browser Extensions

If you have a lot of extensions installed on your browser, try removing the ones you do not need. Sometimes the browser extensions cause a lot of issues – so you can try doing that as well.

6. Restart Your System / Network Equipments

Sometimes restarting your system (and your network equipment) does the trick. So, why not try it out if nothing else works for you?

Wrapping Up

Now that you know all the potential solutions to fix the  “502 bad gateway error“, it should help you troubleshoot the issue, but ultimately, if that’s an issue with the website itself, you may just have to wait for it to be back on line.

Filed in Web..