Almost everyone would have been faced some or the other website errors even once. These are very common in nature, you just need to find out the main reasons for the issue. By knowing about the errors, you can determine its causes and help yourself to fix it. Surprisingly these issues are very easy to fix. Today we came with one such frequent error “502 Bad Gateway”.
Before beginning with its possible solutions, here you should know what this error means & why it appears. If you are impatient enough to read its premise, you can skip directly to its fix “How to fix 502 Error Code?”
What is 502 Bad Gateway?
502 error message describes a situation when the edge server doesn’t get a valid response from the original server or you can say an upstream server. This is an HTTP status code which indicates that something has gone wrong with the server.
There’s an entire array of error codes from 500 to 599- all these appears when the original server and gateway server doesn’t agree on a protocol for exchanging data.
By diagnosing few causes behind it, you can apply the correct solution for fixing this issue.
Why Error 502 troubles?
Depending on web servers you may see different naming conventions of 502 error code, but do remember all mean the same thing.
You might interact with this error as “502 Bad Gateway”, “502 Bad Gateway nginx”, “502 Proxy Error”, “502 Service Temporarily Overloaded”, “HTTP 502”, “HTTP Error 502- Bad Gateway, “Error 502”, “502. That’s an error”
These errors appear due to many reasons, which are discussed below:
- The server where you received this error might have crashed because of memory exhaustion or due to huge number of visitors.
- Due to DNS (Domain Name System) Error, ISP related issues and other networking errors.
- Could be because of your CDN provider. In case you are using any third party (Content Delivery Network) simply disable it. And then check your site again.
- Any Malware infection that has taken control of your Internet browser or has infected browser-related files.
- 502 Error might appear due to the wrongly programmed or configured Server. In this case, you have to contact your Host provider.
But before you bang into your Host Provider, try troubleshooting your device with these different ways mentioned below.
How to fix 502 Error Code?
- Old School Tips
-Restart your System
-Remove your Browser Cache
-Clear your Browser Cookies
-Switch to Safe Mode
-Try using another browser.
- You can hard refresh in your browser
- For Chrome users: Windows/Linux- Press CTRL+F5 together. OR Press F12 to reach Dev Tools, once it gets opened- Right click on the Refresh Button. A drop-down menu will appear that provides you option to clear cache, automatic hard fresh and normal reload.
- For Mozilla Firefox users and other browsers: Press CTRL+? Shift+R
- For Mac Users: Cmd+Shift+R
- Fix your DNS Server
502-error might occur due to improper linking of domain name and IP address. This is probably due to migration of a website to a new host. Entire migration takes some time to propagate to the new host.
Solution is to flush the DNS cache on the local system just like you delete the cache from your browser. Open the command prompt on your system and fire the command below:
On successful flushing of dns cache, the prompt will alert you with “Successfully flushed the DNS resolver Cache” message.
- MacOS users need to fire the command:
- Check for Logs
Logs are the entries of every activity done by you on any application just like a entry made by a gatekeeper in a register. You can check for application logs and its corresponding server-side log. Application logs will tell you about what pages were requested during the runtime of application while server-side log will hold the information about the hardware responsible for execution of application and the status of all the connected devices to the server.
- Disable CDN Plugin
Content Delivery Network(CDN) are the third-party services to render ‘heavy content’ that includes large images and videos. CDN is used by your application to maintain efficiency. The firewall configuration might allow the invalid or malicious content to pass through the gateway leading to 502 Bad Gateway Error. To resolve this issue, you just need to disable your CDN.
- Try using Advanced System Protector
There’s a pretty good chance this error could be a result of a malware infection. These malicious threats have a potential to corrupt, destroy and delete Browser status code-related files.
Furthermore, there might be a possibility that the malware infection has taken control of your Browser and hence created a wall of contagion. Which blocks the way to get a valid response from the original server.
-To get this sorted, Advanced System Protector comes to the rescue. This powerful software easily detects and destroy all your system infections. It’s deep cleaning algorithms focuses on providing real-time protection from any malware, adware & spyware.
-It has a potency of Antivirus, Antimalware and Antispyware techniques, so that no virus can attack you.
-Advanced System Protector is an effective solution to match your immediate scanning demands. With its multiple scan options: Quick Scan, Deep Scan and Custom Scan you can clean your system with ease.
-Not only this, Advanced System Protector is exceptionally light in weight and doesn’t affect system resources.
Trusted by millions, this software is the first choice to identify and remove malware infection that seek to enter your system. You can Download this Fighter Software right here!
We hope now you are aware why 502 Error Code appears and what are the possible solutions to fix it. Perhaps, you may have any other tip to recover this error. If so, please let us know in the comment section below.