The 502 error is a reasonably standard error when the server tries to send responses to requests made by clients with their web browsers but fails, causing the site to become completely inoperative. In most cases, the problem arises when using CDNs (such as Cloud Flare with an incorrect IP) or NOT clearing the cache and the rest of the browser data. This post will tell you what it is, why it occurs, and, above all, how to solve it.
Table of Contents
Error 502 is also known by the “Bad Gateway” tagline. It is not that it always appears with that tagline, but it is most likely that when you find it, it will be with it: Error 502 Bad Gateway.
Error 502 Bad Gateway refers to a server that acts as a Gateway (Gateway in English) and receives an invalid response from the destination server, so it cannot respond appropriately to the Browser’s request. Whenever a web address is consulted on the Internet, the browser sends an HTTP request to the server, and the server returns an HTTP code of the requested request. If this exchange of information does not occur correctly, then the Error 502 Bad Gateway emerges.
Status codes or server errors include Error 500 Internal Server, 501 Not Implemented, 503 Service Unavailable, and 504 Gateway Timeout. Although the exact reasons for each error vary, they can appear in different forms and not always for the same reasons, sometimes, there may be no problem with the servers, but our Browser thinks that “Yes, there is.”
501 Not Implemented. Indicates that the server does not have the functionality to fulfill a specific request.
503 Service Unavailable. This indicates that the server is currently down for maintenance and cannot process the request.
504 Gateway Timeout. It appears to result from a proxy error when waiting a long time for a response from another server.
Before we start mentioning possible solutions for Error 502 Bad Gateway, we are going to review some reasons that can cause it, such as:
There are cases where we can fix Error 502 Bad Gateway very quickly. We will comment on it in the next block.
Pressing the combination of keys Control + F5 in Windows as CM + R in Mac, we will be able to refresh the page that we are visiting. Reloading the web page in question using this methodology could solve the problem, although we will be honest, and doing that does not usually help at all.
We see more effective checking if the website is down using some bold tool: KProxy.com or Host Tracker.
Undoubtedly, another “technique” is widely used but rarely useful for anything, although there are those who have found it helpful to open and close the Browser they were using.
Running a new window in the Browser in private or incognito mode can help us solve the problem with Error 502, since supposedly, these types of windows do not save previous information and manage to load the web with the initial configuration it had, but this is not always the case, and sometimes it does not work.
This solution works very well, especially for cases where old data can prevent a website from loading. Clearing the browser cache is a good way to solve Error 503 Bad Gateway, and not only that, but many other problems, primarily related to content updates on web pages.
We must be aware that we will delete essential data from the Browser by clearing the cache, such as bookmarks, paths, and configuration preferences. So as far as possible, it is best to export the data from the Browser and then re-import it if necessary.
For example, our recommendation in Google Chrome is to go to “clear browsing data…” (Ctrl + Shift + Del). There mark the 3 boxes and click on the blue button “Delete data.”
The more a browser or device is used, the more information it collects and stores, so if we try from another browser or device that we do not use regularly, it may still serve us to check that our website works well.
Regarding the device itself, if it is a Smartphone, you can test the Internet connection through a 3G connection instead of Wi-Fi.
This step helps us decide if the error is related to our network equipment or if the problem is somewhere else.
This can be considered a little trick, but it is curious that if something does not work well, we turn it off ultimately (removing it from the power and everything), we plug it back in, and… magic! Works!
We can start by turning off and on the router, then turning off and on the network devices. After that, please do the same process with the monitor and the CPU; we will turn the entire computer off and on, even disconnecting it from the light, and then plug it back in.
To solve the Error 502 Bad Gateway, we can also try to flush the DNS cache (flush DNS). This method works similar to clearing the browser cache but on the DNS server.
In Windows: click Windows + R or right click on the Start menu -> Run. We type cmd to open the Windows command console. If we still do not have administrator permissions, we execute the cmd command by pressing Ctrl+Shift+Enter. We type ipconfig /flushdns at the command line and hit enter. This command will clear the DNS cache files on the PC and reset the DNS resolver cache.
On Mac OS X: Press the F4 key and then enter the terminal in the Launchpad search field to open the command terminal.
If you are using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, you must enter the following at the command line: sudo killall -HUP mDNSResponder
We can also temporarily change DNS servers. By default, DNS servers are assigned by our ISP. However, you can always change it to a third-party server, like Google Public DNS.
Also Read: NTFS: What Is It, And What Is It For?
One of the most common causes of Error 502 Bad Gateway can be from CDNs or DDoS mitigation services. This is a content delivery network that many web admins set up on their domain to have an additional layer of security between the server and the Browser to deliver web content effectively. However, this layer can have problems connecting to the origin server, especially if the original IP changes after some migration, which results in a 502 error.
For example, the Error 502 Bad Gateway usually appears frequently if in Cloud Flare there is configured a different IP from the server where your hosting is after its IP has been exchanged for that of a new server (usually in the case of migrations).
Hybrid cloud adoption has revolutionized enterprise IT environments. Research from IBM even found that 77%…
Equity investments offer substantial potential for long-term growth, making them a popular choice for individuals…
Do you see it coming, the new trend? The growing concern for data confidentiality? With…
The Mobile Phone Cases And Their Types As cell phones become more important, the need…
AutoCAD will be considered as a powerful tool by the construction, engineering, and architectural sectors…
For the moment, the new lockdown decreed in mainland France spares Reunion Island. If this…