You just tried to access your beloved website but what you see is, an error with a message-’502 Bad Gateway’. Now you might be wondering what is happening to your site. Why you’re not able to open it into your browsers!
Don’t panic, 502 Bad Gateway error is a very common. It affects a large portion of the internet. You will be surprised to know even big names like Google, Facebook, Twitter, etc. are no exception to it.
The aim of writing this article is to make you familiar with the actual causes responsible for this error. I will talk about few quick solutions as well for both users and website owners.
Each time you access a website, your browser sends out requests to different web servers. The servers are responsible to manage these requests and send back an HTTP status code with requested resources. Generally, HTTP status code does not display until any problem arrives along the way.
This is the method servers use to inform each other and end-users about any error.
502 bad gateway error may run into from time to time. Although it is not as persistent as ‘503 Service Unavailable Error’ or ‘500 Internal Server Error’ yet it is a big headache.
Generally, this error means that one of the servers over the internet is receiving an inaccurate response from another server.
Different servers describe and display this error differently. On the basis of your server, you may see a different 502 error. However, the most common ways you may see this error are:
HTTP status codes which begin with no. ‘5’ are associated with errors that happen when there is a communication issue between servers. Most of the time, issue lies within the server side.
As I said above, the error 502 appears when the origin server sends an invalid response to another server, which is acting as a proxy or gateway. Since all the requests on the internet are forwarded via gateways, it can be very difficult to find out the exact point causing this error.
However, I have tried to identify some major culprits that cause this error.
You may see this error if your origin server is not accessible. There can be various reasons for the same such as poor or no connectivity between servers, server is temporarily down, etc.
Firewall offers protection, but sometimes it may become too over-reactive and start blocking the communication between the origin server and edge server.
The other security solutions such as security plugins, mitigation systems or DDOS protection may be responsible for blocking requests from CDS (content delivery servers), resulting in 502 gateway errors.
If you recently replaced your hosting, remember DNS changes can take few hours to get fully active and propagated. How much time it would take depends on the time to live (TTL). During this time period, your site may show this error.
If you are a website owner, there could be various reasons you are seeing 502 Bad Gateway error on your origin server. Below are few methods which may help you resolve this error.
If you are running a WordPress site, it is necessary to inspect your plugins. Most of the time, it is seen that caching plugins lead to bad gateway error. The simplest method to check it would be disabling all your caching plugins for a short time.
For detailed solutions, WordPress users may refer 000webhost.com blog on how to easily fix 502 Bad Gateway error in WordPress.
If you are seeing this error after a certain update on your site, there is a possibility that issue lies on your site itself. You may check your error log for any hints. If you are running a WP site, add the following code line in your wp-config.php file
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );
You can see all the generated entries in the debug.log file.
If you are using a Content Delivery Network or DDoS mitigation services, they may also cause bad gateway error.
If you’re using a CloudFlare, it will return a 502 Bad Gateway error once it has reached a fixed limit. In order to fix it, you may look for their customer support team support or choose to disable CloudFlare.
Check your firewall logs, if you are noticing unusual drops.
If you are a user, then this section is for you. As a user, there are various things that you can try to resolve this error. Though resolving the primary issue will always be the responsibility of the website owner yet you may try the following methods.
It is a fairly simple solution. Wait for a minute or two, then refresh the page you are on. In most of the cases, the error is temporary and a simple page refresh can do the trick.
You may see this error if your browser contains files that were saved once you visited the site with 502 error. If it is the case, clearing browser cache and cookies can be a good approach to troubleshoot 502 bad gateway error.
Try to load that site on different browsers. Incognito mode can be a good idea.
Restart your computer and all networking equipment attached to it.
If you never changed your DNS server, there is a chance you still have the default servers allotted by your Internet Service Provider. You may try using open DNS server like Google Public DNS.
Was there anything we missed? If you have any another tip to fix this error, let us know in the below comment section.
Many businesses in Adelaide are beginning to utilise SEO as an integral part of their…
In this article, you will learn why marketing via text messages is vital to your…
Over the years, Google has introduced several new features to enable different aspects of digital…
Join us as we discuss how to get the most from some of the major…
As the organizations keeps on seeking new possibilities that can be leveraged to optimize their…
Instagram is associated with digital marketing activities that lend a hand to the business to…