Internet networks are one of the aspects of the IT world that has increased and increased over time, and what will be much greater, thanks to the millions of new devices, new areas to cover and new technologies to offer better speeds , greater support and better network stability both at the Ethernet and Wi-Fi level ..
Regardless of the technology and use that is given to the internet, no user escapes any of the hundreds of errors that can occur in the daily use of the network , obviously we talk about access to the web . One of the most common mistakes is the 502 Bad Gateway error which can appear suddenly and in 5 seconds everything goes from being normal to staying there affecting the optimal access to the desired website.
It is one of the most common errors at the network level and we can see them in normal web accesses:
Or, when one of the Internet service providers presents some type of failure:
Regardless of the cause for which the error is generated, this affects the way we access a website and if we are talking about an organization it can be a tedious task for network administrators. For this reason, today TechnoWikis will make a complete analysis of what this error is and how to give a practical solution for its correction..
1. How to fix error 502 Bad Gateway
Error 502 Bad Gateway is a problem that, as we can see, the server returns when it is not able to process an input request for multiple reasons such as a communication failure between two servers, failures in network devices or overload in any of the configured network elements.
The most common cause of this error is due to a communication failure. The reason is simple, as the name implies (Bad Gateway - Gateway Failure), occurs when the client computer tries to establish a connection with a server that has the function of acting as a gateway or as a proxy and is at its Once you need to access a server that is in a higher hierarchy to establish proper communication with the site. If this higher-ranking server generates an error, such as not responding correctly to the request, error 502 Bad Gateway will be displayed.
But there are additional reasons why it appears as:
Web Server Overload
This is a common cause since, at the time of configuring a web server, a limit of simultaneous connections is established and if at a certain moment the web server reaches or exceeds these limits, it will remain “hung†and will no longer be able to Respond to requests requests, which results in error. But this web server overload is not only due to an excessive number of requests, it can also be generated by some type of DDoS attack whereby the capacity of the server is overloaded with the help of a botnet which intentionally fills its resources.
Communication error between the devices
Firewalls or Firewall are devices developed in order to prevent packages with suspicious content from accessing the computer, these Firewalls are used in organizations, in order to block the communication of these packages with both the external and local network. In this way a bad Firewall configuration can result in the 502 Bad Gateway error when assuming that a website is dangerous causing its blocking.
Web server crash
These drops occur for some reason such as maintenance, electrical damage, software support, etc., so that access to this server and its hosted pages will be impossible for a certain time.
Browser failures
Modern browsers, such as Google Chrome, Safari, Firefox Quantum, etc., are full of numerous functions but many times saturating the browser with add-ons and other tools can cause the browser to reach a point of error where access to the websites.
It is ideal that we understand that the 502 Bad Gateway error has different ways of being deployed, as we saw at the top, and some associated codes are:
- HTTP Error 502 - Incorrect Gateway
- 502 Service temporarily overloaded
- 502 Server error: The server encountered a temporary error and could not complete your request
- 502. That is a mistake. The server encountered a temporary error and could not complete your request. Please try again in 30 seconds.
We understand that the causes of this error are varied and that is why TechnoWikis brings some practical solutions for its correction.
2. Update the website to fix error 502 Bad Gateway
One of the causes of this error is due to sudden drops of the website but which pass in a few seconds, for this, if the website we access presents this error, we can update the website by pressing the F5 key or by clicking on the refresh button of the page located in the URL bar of each browser:
F5
3. Restart or validate the browser to solve error 502 Bad Gateway
As we mentioned, in some moments the cause of the error is due to some kind of temporary failure in the browser, a practical solution is to close all active windows and start a new session and try to access the website with error and check its connectivity.
Step 1
The 502 Bad Gateway error occurs when the website we wish to access presents some kind of response, we can check if a certain website is active or not by visiting the following website:
Tester
Step 2
There, just enter the website in the respective field and press Enter to see if the desired site is active (Up) or down (Down):
4. Clear browser cache to fix error 502 Bad Gateway
As we visit websites, they host cache memory within the browser so that future access to them is much faster, but this, although useful, can have a negative impact on the browser's operation. since a cache overload subsequently affects access to the site especially if this site has made changes such as a new IP address, a new domain, etc. In this case the goal is to clear the browser cache in order to prevent this type of error.
Google Chrome
For this, in the case of Google Chrome, we will go to the next line directly from the address bar. There we activate the box “Images and files stored in cache, define the frequency of time and click on Delete.
chrome: // settings / clearBrowserData
Firefox Quantum
In the case of Firefox Quantum we will go to the following route:
about: preferences # privacy
There we click on the "Clear history" button and in the window displayed we activate the "Cache" box and click on the "Clean now" button:
Note
Using these methods we can also delete cookies from browsers which are another element that websites host for much faster access in the future to them.
5. Access the browser in safe mode to solve error 502 Bad Gateway
When using current browsers it is normal that we install various extensions or add-ons to improve the benefits of this but those elements can play against us, one way to rule out that these extensions are the cause of error 502 is to access the browser safely and so use default settings without add-ons or extensions, including toolbars.
Step 1
To do this, we must access the command prompt and execute the following:
Firefox Quantum
If we use Firefox:
"C: \ Program Files \ Mozilla Firefox \ firefox.exe" -safe-mode
Google Chrome
If we want to open Google Chrome in safe mode, we execute:
"C: \ Program Files (x86) \ Google \ Chrome \ Application \ chrome.exe" --safe-mode
Internet Explorer
In the case of using Internet Explorer we execute:
“C: \ Program Files \ Internet Explorer \ iexplore.exe†-extoff
6. Adjust the DNS servers of the equipment to solve error 502 Bad Gateway
DNS servers have the function of converting the IP address into domain names and vice versa so its function within the world of networks is vital, but when we use the DNS server that has been provided by our network provider (ISP), this It can lead to failures that prevent ideal access to websites.
In this case TechnoWikis advises to establish new DNS servers and a totally practical solution is to use Google's public DNS which are available for free and have a great hardware capacity to guarantee DNS stability..
Step 1
To edit this, we will go to the following route:
- Center network and sharing
Step 2
There we click on the “Change adapter settings†line and then we will right click on our network adapter and select the “Properties†option:
Step 3
In the new window we select the line "Internet Protocol Version 4" and click on the "Properties" button:
Step 4
In the next window we activate the “Use the following DNS server addresses†boxes and set the following. Click on OK to save the changes.
- 8.8.8.8 as preferred server
- 8.8.4.4 as an alternative server
7. Verify network devices to fix 502 Bad Gateway error
The fundamental component of any network topology is the equipment that provides such network services such as routers, modems, etc., which without them would be impossible for access to websites to be correct. We can review aspects in these teams such as:
- Check the connections on both the equipment, Ethernet sockets, and the network equipment.
- We can reset the modem or router in order to reload network services.
- Validate that the electrical connections function correctly and that these devices are connected in the correct way.
- If it is necessary to change the network wiring between the modem or router to the equipment
- In case of using Wi-Fi network connections, check that there are no elements that interfere with the signal such as walls, electrical devices, etc.
8. Update Forefont to fix error 502 Bad Gateway
Many 502 errors are generated by some type of administrative task on the part of the website owner, such as maintenance, new site name, new conditions of use and more, so if no solution works, we can find a way to contact with the site either by email or telephone, to know in detail the cause of the website crash and thus determine which is the best way out and not waste time or resources on solutions that will not have a positive impact at the level of Connection.
This is a particular case and therefore does not apply in all situations, when we have MS Forefront TMG SP1 installed and one of the following messages is generated, Error: 502 Proxy error. The network login failed. (1790) or a similar message when accessing a website, we can download update 1 for Microsoft Forefront Threat Management Gateway (TMG) 2010 Service Pack 1 at the following link:
Management Gateway
9. Update the operating system to fix error 502 Bad Gateway
It never hurts to remember that keeping our systems updated is a guarantee that many errors of both the system and applications will be solved, this is because the developers create new options to optimize the elements installed in the system.
In Windows 10
In the case of Windows 10 we can go to the following route to update the system:
In macOS
In the case of macOS we will receive notifications through the App Store where the availability of updates for the system is indicated and in the case of Linux environments we will also be notified of these or we can execute commands such as:
sudo apt update sudo apt upgrade
10 . Clear the system DNS cache to fix 502 Bad Gateway error
We have mentioned how to clear the browser cache, but another useful option is to clear the DNS cache of the operating system, this in order to try to refresh (flush) the local DNS cache. To do this we must execute the following from the terminal:
11. Run SFC to fix 502 Bad Gateway error in Windows 10
SFC (System File Checker) is a command line utility for Windows systems through which a thorough analysis of the Windows file system is made in order to detect errors and thus proceed with their correction.
For this, we access the command prompt as administrators and execute the following command:
sfc / scannow
We have checked several alternatives that we have at hand to correct this frequent error when accessing websites and thus connect in the ideal and expected way.