What Is the “502 Bad Gateway” Error? How To Fix It?

how to fix 502 bad gateway error

So you tried accessing a website and ended up with an obscure error saying, “502 Bad Gateway.” Now, what? First things first, you don’t need to worry anymore because this article answers all your questions related to the error code.

Although this issue usually means a problem on the server-side, there are instances where changing a few things on your end can fix the 502 Bad Gateway error.

But, before we dive into the possible fixes, let’s understand what exactly causes the issue.

What Is 502 Bad Gateway Error?

Picture this; you need to reach out to the person sitting one seat behind you. Normally, you would pass your message to the person right behind you and tell him to do the same. Now, let’s assume the recipient of your message ignores the middleman. So, the middleman shows you a red flag in response. This is similar to what usually happens during the 502 Bad Gateway error.

A screenshot of 502 Bad Gateway error.

In technical terms, this error occurs when the server your system is communicating with is a proxy or gateway to another server. When the recipient server is overloaded with requests, it might send a “bad response” to the proxy server. The same response is then sent to your system. In the HTTP lexicon, this response is known as the 502 error.

This issue appears in various forms across websites. Some common variations of the 502 error are 502 Service Temporarily Overloaded, Temporary Error (502), 502 Proxy Error, 502 Bad Gateway Nginx, etc.

Also Read: How To Fix ERR_CACHE_MISS In Chrome? – 2021 Detailed Guide

How To Fix 502 Bad Gateway Error?

When on the server-end, this error is temporary and, in most cases, lasts only for a short time. However, your browser could also misread a network problem in your system as a 502 Bad Gateway error. To find out whose end the problem is, you can visit this website, enter the URL, and check the server status.

If the server is up, but you’re still getting the error, you can try restarting the browser, using a different browser, and restarting the system. If the problem persists, then you can try the following fixes.

Clear Cache

Your browser intuitively stores temporary data of the web pages you often visit to speed up loading time. Sometimes, this data (called “cache”) gets corrupted, which could cause a 502 error. To fix this, you have to clear your browser cache.

Steps To Clear Cache In Chrome

  • In the browser, tap on the menu dots (next to profile icon) in the top-right corner
  • From the drop-down, select ‘Settings’
  • Now, select ‘Privacy and security’
  • Go to ‘Clear browsing data’
  • Make sure only ‘Cached images and files’ is checked, and then click on ‘Clear data.’

Clear Cookies

When you access a website, it saves your session information on the system to give you a personalized experience the next time you visit it. Much like cache, this session data (called “cookies”) can become corrupt over time, possibly resulting in the Bad Gateway error. To fix this, you have to — you guessed it right — clear your cookies.

Steps To Clear Cookies In Chrome

  • Follow all the steps in the previous fix, except the final step
  • Now, make sure only ‘Cookies and other site data’ is selected, and then click on ‘Clear data.’

Disable Plug-ins And Extensions

Plug-ins and extensions are some cool extras we get with certain browsers. While these added features are useful, they can also interfere with your browsing experience if you run into a bug.

Now, I know you don’t want to give up on your cherished ad-blocking extension, so I’ll tell you the best way to go about this.

Initially, disable all the plug-ins and extensions (steps mentioned after this paragraph) and check if the site works. If it does, keep enabling your disabled features one-by-one and keep checking if the site still functions. Use this way to narrow down the plug-in/extension causing the problem and then exclusively disable it.

Steps To Disable Plug-ins And Extensions On Chrome

  • In Chrome, click on the “Extensions” icon (left of the profile icon) or just enter “chrome://extensions” (without inverted commas) in the address bar
  • If you clicked on the “Extension” icon, you now need to select ‘Manage Extensions’ from the menu that pops up. Those who typed in the address can skip this step.
  • Now, the ‘Extensions’ tab will load up. From there, turn off the toggle for each extension currently enabled in your browser.
chrome extensions to fix bad gateway error

Restore Default Settings to Fix 502 Bad Gateway Error

Although getting rid (temporarily) of cache, cookies, and extensions might make your browser look “default,” it won’t truly resemble a default browser until all the factory settings are restored as well.

In certain cases, starting from scratch with a clean browser helps nullify any problem-causing setting tweak you might have done in the past. This can potentially resolve your HTTP issue.

To hit reset on your Chrome browser, follow the steps given below.

Steps To Restore Default Settings In Chrome

  • In Chrome settings (by now, I expect you to already know where this is), click on ‘Advanced’
fix 502 error
  • From the drop-down menu, go to ‘Reset & clean up’ and select ‘Reset settings to their original defaults’
restore 502 bad gateway
  • When the prompt shows up, select ‘Reset settings.’
reset settings to fix 502 bad gateway

Change DNS (Domain Name System) Server

If none of the above fixes work, you can take it up a notch and get into the nerdy side of things as a last resort. I’m talking about changing your DNS server — the computer your browser communicates with for visiting all those websites on the internet.

Assuming you’ve never touched it, your current DNS was most likely set by your ISP. You can change this and check if the issue gets resolved. Moreover, there are more tempting reasons to go ahead with this, as switching to a third-party DNS can also give your internet a speed boost.

Since this topic is a little too big to be covered in a few points, you might want to check out our dedicated guide for changing your DNS server.

Finally, if none of these suggestions resolved the 502 error for you, then it’s extremely likely the problem is not on your end. That means nothing you can do but wait until the website fixes the issue on its end — which can take anywhere from a few minutes to several hours.

Hopefully, this one will be a short wait. But, until the website is down, why not just go out get some fresh air. Maybe, soak in some sunlight. Just go outside.

Similar Posts