Sometimes, when you try to visit a webpage you’ll get a 502 Bad Gateway error.
This error is usually related to the website itself and not to your computer or connection, however there might be a few times when you’re getting the error due to a problem on your end.
To make sure that the problem is not on your end, there are a few fixes you may try.
What’s a 502 Bad Gateway Error?
Just like a 404 Not Found error, the 502 Bad Gateway error is an HTTP status code. It means that the server you’re trying to connect is receiving its information from another server, but that it has had a bad response.
There’s not an exact issue for the bad response, and, therefore, for the 502 Bad Gateway error.
It can happen due to an overloaded network or to an actual connection issue between the two servers, but it can also be caused by a badly configured network or a website coding error.
This means that the 502 Bad Gateway error can be a temporary issue or that it can be a permanent one that will happen until it’s fixed by the website’s engineers.
How to Fix a 502 Bad Gateway Error
Like we’ve said, the error almost never happens due to a problem on your end.
It’s a problem on the website. However, there are a few fixes which will make sure that you don’t have any problems on your end.
Refreshing the Page
It seems obvious, but since 502 Bad Gateway errors are often due to an overloaded network, simply refreshing the page will fix the problem.
There are several ways to reload a webpage. You can press F5 or CTRL + R on any browser. Alternatively, you can also press the refresh icon located at the top of the page or reinsert the URL.
Even if it doesn’t fix your issue, refreshing the page will only take a couple of seconds. Worst case scenario you get the 502 Bad Gateway error again.
Starting a New Browser Session
It is unusual, but there’s a small chance that your browser is the cause of the error. A bug might’ve happened during your normal web browsing activities that’s making the browser assume that the site is giving a 502 error.
To fix this, or to check if this is the case, simple relaunch your browser. Close every single tab and open the browser again. If you try the website and succeed then you know that the problem was on your end — particularly on your browser.
Clearing Your Browser’s Cache
Your browser cache can be the cause of the 502 Bad Gateway error, especially if you’ve recently visited the site and it had the error. Corrupted and outdated cache files can also be causing the issue.
Luckily, cleaning your browser’s cache takes no time at all and is very simple, although it depends on which browser you’re using.
Clearing Your Cache on Internet Explorer
The easiest way to clear your cache on Internet Explorer is through the Control Panel, under Internet Options.
Just head into the General Settings and click “Delete” under “Browsing History”. Even though you can delete everything from your browser, what you’re really interested in is the cache data, here known as “Temporary Internet Files and Website Files”. Just check that box and click delete.
Clearing Your Cache on Mozilla Firefox
Cleaning Firefox’s cache is also very simple. Just open your browser and click on the menu icon in the top right corner. From there, choose “History” and then choose “Clear Recent History”.
Then you need to select “Everything” in the time range to clear section, and you want to open the “Details” tab so you’re able to see what exactly it is that you’re deleting. You can delete everything you wish to, but what we’re really interested in here is the cache.
Tick the appropriate boxes and press the “Clear Now” button and your browser’s cache will be cleared.
Clearing Your Cache on Google Chrome
Open Google Chrome and its menu, located on the top right corner. Select “History” and click on “Clear browsing data…”
You want to clear data since “the beginning of time” and you want to make sure that you’ve ticked the “Cached images and files” box. You can tick whichever other boxes you’d like to delete and finally press the “Clear browsing data” button.
Clearing Your Cache on Safari
With Safari open, open its “preferences” window (the easiest way to do it is by pressing “CMD + ,”) and head into the “Privacy” tab.
Press the “Remove All Website Data…” button and then click on “Remove Now”.
If the problem still persists then you’ll know that it wasn’t your cache’s fault. Remember that the problem is most likely on their end.
Deleting Your Browser’s Cookies
If deleting your cache doesn’t work you can try clearing your cookies. It is done exactly the same way as in the previous step, but you need to mark “Cookies” for deletion.
The reason why we didn’t tell you straight away to delete your cookies, was because your cache could be to blame and because deleting your cookies will log you out of every website you’re logged into.
Opening Your Browser in Safe Mode
Your browser’s safe mode ensures that it is running without any extensions or plugins on top. If you manage to reach the website while in safe mode, but using your browser normally results in a 502 Bad Gateway error then you’ll know that you have a problem in one of your extensions.
Try disabling your extensions one at a time while constantly refreshing the website to try and figure out which extension is causing you trouble. Once you’ve found the culprit, disable it.
Trying Another Browser
There’s a chance you already have another browser installed on your computer, most likely Microsoft’s Edge or even Internet Explorer. You might also have Google Chrome, if you’re a Firefox user, and vice-versa.
Trying to reach the website with another browser rules out any possible problems with your browser. If you’re able to visit the site with a browser other than your daily driver, then you’ll probably need to reinstall it. Even then there’s no guarantee that it will fix your issue.
Remember to only reinstall your browser after trying to reach the website while in safe mode. The problem might not be directly related to your browser but to one of your extensions.
Restarting Your Computer
Restarting your computer is the quintessential fix for hundreds, if not thousands, of issues. It’s something you can try out very easily and without too much trouble. Of course there’s a chance that your issue won’t be fixed, but you’ll never know until you try.
Restarting Your Router / Modem
Like restarting your computer fixes lots of problems, restarting your networking equipment is the go-to fix when it comes to network problems.
Remember that you don’t simply want to unplug and plug back in your router or modem, you want to power cycle it. Although it seems complicated, it actually is the same as unplugging it and plugging it back in, the main difference is that you wait for a minute or so before plugging the power back on.
Again, if any of these fixes isn’t working, remember that there’s a huge probability that the problem is on the website end and not on yours. Still, if you’re able to access the website on your mobile network or on another network, there are still a few fixes for you to try.
Changing Your DNS Servers
Here’s how you change your DNS address:
- Open the Control Panel
- Choose “Network and Sharing Center” (If you can’t find it, make sure that you’re on the small icon view type)
- On the left side, choose “Change adapter settings”
- Right click on your wi-fi connection and choose “properties”
- Scroll down to “Internet Protocol Version 4 (TCP/IPv4)” and click on “Properties”
- Then, choose “Use the following DNS server addresses” and set your preferred DNS server to “220.127.116.11” and your alternate DNS address to be “18.104.22.168”. These addresses are Google’s DNS addresses
- Click “OK” and restart your computer
Check if the Website is Down for Anyone Else
To really make sure if the problem is on your end, you can simply ask someone else to try and access the website. If they can, then you definitely know that the problem is on your end.
If you don’t have anyone to ask, or you don’t have access to another computer and another network, then you can go to one of the many websites that tell you if another website is down.
If those websites tell you that the website is down, then you know that the problem is on their end.
Visiting the Website at a Later Date
If none of these fixes work, then you know that the problem is on their end. If that’s the case, then there’s not much you can do other than wait.
If you really want to, and if the problem persists after a couple of days, you can try and contact the web admins directly, letting them know about the issue.
Waiting is often the only fix that works when it comes to a 502 Bad Gateway Error
Petr is a serial tech entrepreneur and the CEO of Apro Software, a machine learning company. Whenever he’s not blogging about technology for itechgyan.com or softwarebattle.com, Petr enjoys playing sports and going to the movies. He’s also deeply interested about mediation, Buddhism and biohacking.