502 bad gateway error is one of the most common problems we come across while accessing a website. But not many users know the reason behind this crash. Whenever we enter a URL, it passes through a gateway to receive information. The code 502 bad gateway refers to an error or bug within the main server. It is this server that also often acts as the gateway or the firewall. And since it is an internal breakdown on the server’s side, there’s little that you can do to fix it.
These are some ways you can try to resolve the 502 bad gateway issue:
- Refresh the webpage
- Clear cache from your browser
- Go Incognito
- DNS flushing/changing server
- Log in through another device
- Run error log
- Check plug-ins and themes
Let’s get into each point and discuss them in detail.
Refresh The Webpage
At times, due to heavy traffic on the website, it displays such error codes as 502. So, first and foremost, try the age-old trick that mostly works for all tech issues. Wait for a few minutes and tap on refresh buttons. For example, in Windows, press F5 or CTRL + F5, and Mac users can tap on CMD +R. Moreover, you can also use an online tool to check if the website is offline. This will determine who’s at fault here.
Clear Cache From Your Browser
When we do not clear our browser cache for a very long time, it collects hundreds of outdated files and codes. All these may be harmful but stops you from accessing websites and displays the message 502 bad gateway error. So, clear your browser cache and then go to the URL to see if its working fine now.
Often, it is not the website but your browser causing the error. To check for the same, try to access the URL from an incognito mode. If the website is opening fine in this mode, your browser extensions may be causing the problem. You can do two things.
First, try accessing the website from a different browser on your computer. And second, remove all the plug-ins and extensions on your current browser. Once you remove the problem causing an extension, the problem will most likely resolve.
Also Read: How To Set Up 3 Monitors In Windows 10?
DNS Flushing/ Changing the server
Sometimes a website can have this error for incorrect IP addresses and unresponsive DNS servers. Thus, you need to flush the DNS cache and wipe out faulty files from your server. Another option you can try is changing your DNS server to a third-party server.
Log In Through Another Device
Another way to find out where the problem lies is by accessing the website on another device. Change the network from your current one and try loading the site. Moreover, you can also switch off your computer and unplug it from the wireless router. Wait for some time and plug it again. Finally, switch on your computer and try accessing the webpage again.
Run Error Log
If you face the 502 bad gateway problem after a recent update, the problem may lie in your server. Therefore, in this situation, you can check for the error log. To do that, go to the admin dashboard or enable it by typing a code in WordPress: wp-config.php. When you do this, errors will appear in the form of wp-contents/debug.logfile. And this is where you will be able to trace out the problem causing one.
Check Plug-ins And Themes
If the issue did not resolve even after trying these methods, you could check for the plug-ins and themes. Unfortunately, sometimes plug-ins and themes have faulty codes that do not coordinate with each other. And as a result, the 504 bad gateway where it is your server is stopping all communications.
Furthermore, a content delivery network may also hinder your access to a website and display of the message. They often add a layer between the client and the main server to put a barrier against the communication. Reach out to your customer support executive and explain the problem to them. They will be the perfect people to fix the 502 bad gateway problem.