What is a 502 bad gateway error and how to fix it?

Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training

Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days

Imagine the scene, you are going to access your site and you see that it does not work. Your website is down and you want to remedy it as soon as possible, as is normal.

The only clue you have to solve the problem is a message from error 502 bad getaway.

If this happens to you, you don’t have to worry, I know these messages are scary but it’s very easy to solve like almost everything in life.

The best thing is not to stress because in this tutorial you are going to see how to make your website stop showing that error message and return everything to normal.

What is the 502 Bad Getaway error?

A error 502 means that there is a wrong gateway. It usually occurs because there is a problem unrelated to your computer or browser.

In summary, the problem usually occurs because a server receiving an invalid response from another.

If you find yourself when accessing a website a message like “Error 502”, “502 Bad Gateway”, “502 Incorrect gateway”, “502. That’s an error”, etc… you have this problem.

Don’t worry, because there are many websites that have gone through this notice.

Various errors can occur on any web page from time to time.

There are different . Maybe you’ve even met them already, being the most common 404 and 502.

Both are within a different group:

  1. 4xx errors: normally generated by the web administrator
  2. 5xx errors: They usually happen due to problems unrelated to the computer or browser, and the hosting may be the cause.

The process is usually: if something is wrong on the web, the server sends an HTTP status code to the browser to identify the problem and fix it.

The most common errors are the following and among them the 502 error.

A 502 error is an error that occurs when access to a website is not correct.

It is also known as “Error 502 Bad Gateway nginx”, “Error 502 apache”, “Error 502 Bad Gateway cloudflare” or “bad gateway”.

The 502 error usually occurs when there is a communication problem between 2 servers being “the fault” normally of the higher level server.

The user makes the request to the server, which in turn makes another request to a higher level, producing the 502 error.

It is not always a server problem, sometimes the problem comes from the browser, although it is not usual

Reasons why a 502 error happens

The causes for which a 502 error usually occurs are the following:

  • Fallen server that is carrying a lot of load.
  • There’s a firewall blocking application.
  • error in the communication between servers that they have not agreed on the protocol to be used for the exchange of information.
  • The proxy server that has received your communication not able to route to the end server.
  • A go request goes to an end server that is currently Out of service.
  • one of the servers not properly configured.
  • problems with the CDN (in case you use one on your website).
  • browser error (as we have said it is less common).
See also  In Warehouse, under Prestashop 1.7, the images appear...

Normally the problems do not come because the server is down, it is usual that there is a problem in the protocol that must be used for the exchange of information between both servers.

You have to keep in mind that these types of answers they may be cached so it is possible sometimes that the error continues to be displayed even though it has already been solved.

That’s why it’s important refresh the page and take another series of steps as we will now see.

10 steps to fix a 502 error

We are going to see the solution in a simple way to try to repair these errors as soon as possible.

If the search engines go through your website for a few minutes, nothing happens, but if the time extends to 6 or 7 hours, things can get complicated.

Therefore, the first thing you have to do is cCheck if your website is down or it’s just you who can’t access it.

If you have checked and the problem persists, follow the steps below to find the solution to the problem:

1. Reload the page

To rule out that it is a browser problem, the first thing you should do is refresh the web.

Press Ctrl + f5 or the refresh button and reload the page, it is possible that the web is overloaded.

Check if you can already access. If not, close all browser windows, wait a minute or so and check again if you can now enter your website.

2. Clear your browser’s cache and cookies

It is very common that the error continues to be displayed because the browser continues to display the error message from a previous copy.

To check whether the message is current or not, you have to clear your cache and also cookies.

To do this, you only have to access the upper right or left and in Settings> Privacy and Security> Clear browsing data, the copies will be deleted, serving current results (access varies depending on the browser).

Try now if it already works, otherwise we continue with the next method.

See also  Statistics Management with Google Analytics -

3. Try using a different browser

If it still doesn’t work try use a different browser (Chrome, Firefox, Opera…).

If it works with a different browser, then the problem is clear and you can continue with the next step.

If you can access normally, it is best that uninstall the browser that was failing and reinstall it again.

Now, if the error persists even from another browser, go to the next method to solve the 502 error.

4.Reinstall your browser

When you do the reinstallation it should work perfectly like the rest of the browsers.

Restart the computer for a better check.

5. Check if the web is seen from another device and from another ip

If the 502 error continues to appear, try viewing the website at another device or from a different ip.

6.Disable the CDN

A CDN o content delivery network (Content Delivery Networks) serves to improve the loading speed of websites by hosting these resources to make the web less heavy.

However, they can sometimes cause the 502 Bad Gateway error due to the use of additional firewalls.

To check if the reason for the 502 error comes from here, temporarily disable your CDN and check if the error is gone.

7.Check DNS.

If you bought the domain on another platform external to the server, check that the DNS from the last batch are well noted on the domain platform.

You have to take into account that if the site is new, the DNS takes approximately 24 hours to propagate.

During that time it is very normal that the 502 error may arise.

8. Deactivate plugins or templates from the hosting control panel

The most normal thing is that you cannot access your web.com/wp-admin of your WordPress.

With this, everything would be easier, since the objective is disable all plugins and activate one by one to detect if one of them may be creating a conflict that is causing the 502 error.

This is not a problem, since you can work on the folders through tools like Filezilla or the server’s control panel.

For disable all plugins From the control panel you have to do the following:

  1. Enter the File Manager option, go to the wp-content folder and change the name of the Plugins directory to “Plugins-disable”.
    What you will cause with this is that all plugins are deactivated at once.
  2. Now you can go to the web and see if the error has disappeared. With this you will know that the error comes from one of the plugins.
  3. Now the task is detect which. To do this, go back to rename the folder to its original name “Plugins” and enter the folder and do the same process as before but one by one, that is, for example deactivate the plugin “wprocket” by putting wprocket-deactivate”
    Cache plugins on many occasions due to the issue of minification and combined css and javascript files can be one of the causes of the problem.
  4. you have to go see one by one until the error disappears, when it does you know which plugin is causing the error.
See also  Insert interactive PDFs with several links

From here you have to detect why it fails.

If you are able to detect the problem, fix it, if not, the WordPress repository has similar pluginsI’m sure you’ll find a similar one.

9.Test if your site is down

If you want to check if your site is still down you can do it using the web.

This site allows you to enter your web page in the field it offers and this it will tell you the state it is in the same.

10.Contact your hosting provider.

If the server you have contracted is of quality and offers good support, you will not have to worry about anything.

In the case of , they will help you quickly to solve this type of error.

If with the previous steps you have not been able to solve the 502 error, a hosting like will find the solution.

Log analysis, restart the php version, increase the timeout to process the php; These are some of the tasks to be carried out by your hosting.

If with the other 9 steps above you have not been able to fix the problem, your quality server will find the solution.

conclusion

As you have seen, the 502 error is very common and that you find it on your website is not alarming since it has a solution, as you have seen.

My recommendation is that follow all the steps in the article from number 1 to 9 until the error disappears.

If you have not been able to go to your server and say goodbye to 502 bad getaway error.

Help us improve our content by sharing your opinion

Web designer, SEO and Digital Marketing consultant | I work as a freelancer making websites for clients who want to grow their business through the internet | In addition, I teach in my Blog how to create a web project absolutely from scratch | You can find me on social media.

Loading Facebook Comments ...
Loading Disqus Comments ...