502 Bad Gateway - What is that & How to solve? How it affects your rankings?
Tags: 502, webdev, badgateway
Published: 2021-01-29 12:25:00

**502 Bad Gateway** - this error message often causes confusion and frustration on the *Internet* because it prevents users from visiting the desired website. In this article, we will tell you exactly **what “502 Bad Gateway”** means, how the message affects your Google rankings and how you can resolve the causes of the error message.

##What does " 502 Bad Gateway " mean?
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0aggsopzkjahz2utt1ad.png)

The HTTP error code *"502 Bad Gateway"* indicates that the server is not getting a response from the requested URL because the gateway is not working. This means that no data exchange is possible and the desired website cannot be reached by the user.

###A little digression: about gateways, proxies and servers

You may not be able to do much with our definition because you are not yet familiar with terms like **“gateway”**. No problem: we will take a short break.

Whenever you visit a website, your browser contacts a server. This sends back the requested content - together with an HTTP status code. If everything works as it should, you as a user cannot see this code. But if there is an error it will be displayed to you.

Data is generally transferred on the Internet via gateways, sometimes also referred to as proxies. Ultimately, this is just a server that stands between you and the main server with the required data and through which communication takes place.

Error codes from the 500 series **usually originate from the server. " 502 Bad Gateway" means that the server could not be reached or that there is a defect in the communication chain.**

##This is how error 502 affects your SEO

If the “502 Bad Gateway” error only lasts a few minutes on your website, you don't have to worry about a major impact on your [ranking](https://jaydipbaba.com/search-engines-site-rank/). If a crawler should come by you during this time, it can also load your website from the cache.

It becomes problematic if the error message is not resolved for several hours. If users try to visit your website but only get a 502 message instead of the actual content, *Google takes note of this.* It is obvious to the search engine that there are difficulties on your part. In the worst case, it will cause your website to slide down in the search results.

##Causes of "502 Bad Gateway"

The error message 502 may have quite different causes. However, it is difficult to find out what exactly it is. This is exactly what makes the notification so frustrating for users.

**The following scenarios are conceivable:**

* The web server has failed or has been switched off.
* The [server is overloaded](https://web.dev/overloaded-server/) - for example, because an unusually large number of users want to access the same website at the same time.
* Browser extensions interfere with communication.
* There is an error in the [PHP](https://dev.to/t/php) code on your website.
* [Firewalls disrupt](https://support.sophos.com/support/s/article/KB-000036825?language=en_US) communication.
* The user is [not connected to the internet](https://in.pcmag.com/networking/47020/12-tips-for-troubleshooting-your-internet-connection).

##502 Fix: You Can Do That

What measures are needed to ensure the error message *"502 Bad Gateway"* to fix depends on the causes. As I said, these are unfortunately not always easy to identify. Fortunately, it is often enough to wait for a little. In many cases, your hosting or internet provider will take care of the problem on its own.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7o8uywtmok65bnobao56.jpg)
[Image Source](https://tej9.com/magento-seo-tips/)

It is, therefore, best to visit the website again after a few minutes or hours. You only have to take action if the error message persists.

###Go to another website
Try to go to another website. Do you also get a "502 Bad Gateway" message there? Then the problem may be on your side. First, check that your WiFi is working. If necessary, connect to the Internet using a LAN cable and test the affected side again.

###Test who is affected
If the page is still not available, you can go to [downforeveryoneorjustme.com](https://downforeveryoneorjustme.com/) to test whether the problem only affects you or all other Internet users. This already gives you an indication of where in the data chain you need to look for a solution.

###Clear the cache and cookies
If you have the problem, clearing the cache and cookies can help. This ensures that the actual webpage is loaded and not a possibly broken cached version.

###Check your browser
Go to the website in a different browser. If it works properly there, the problem may be in your first browser. Restart it once.

If the problem persists, open the browser in Safe Mode. All installed extensions are then overridden. Please visit the website again. If it can now be reached, the malfunction was probably caused by one of your browser plug-ins. Otherwise, you can try reinstalling the problematic browser.

###Change the DNS server
In some cases, the reason for the " bad gateway " is with your Internet service provider. Then there is usually an incorrect entry on the [DNS server](https://www.cloudflare.com/learning/dns/what-is-a-dns-server/).

Switch to another DNS server in your computer settings, for *example*, [Google DNS](https://developers.google.com/speed/public-dns) and contact your Internet provider.

###Contact your hosting provider
If the unreachable website is your own, you should contact your hosting provider. Often the mistake is on his side.

###Check your website
If you have excluded problems with your hosting provider, check the PHP programming and the database of your website. In case of doubt, use an older backup of your site to correct the error.

##Bypass "502 Bad Gateway"

If you are affected by error 502 not as a webmaster but as a user, there is a little trick you can use to avoid it.

Google stores caches from websites. Enter " cache: "  and then enter the URL in the search field and this version will be displayed. However, it is not up-to-date and may therefore contain outdated information.

The error message “502 Bad Gateway” is without question annoying. Fortunately, in most cases, the problem will resolve itself within a few minutes. So next time, just get up and brew some tea. Only if you still cannot visit the website should you start troubleshooting?