Yumea

502 error on WordPress: where does it come from and how do you fix it?

Yumea·

There is nothing more frustrating than being unable to identify the cause of an error on your website. This is especially true when you do not know how to fix it, or when it is a 502 error, which can stem from many different causes.

The 502 error, or 502 Bad Gateway Error, is one of the most common encountered while browsing the web. Despite this, its origin can vary, which is why it is difficult to identify where it comes from and therefore resolve it quickly.

Where does it come from?

Most often, this error originates from the server, in which case there is nothing you can do as a user. You will therefore need to contact your website's hosting provider so that they can tell you more about the problem and fix it quickly.

In other cases, it can also appear when the browser reports it on a page where it does not exist, or when your connection as a user is faulty.

Although these cases remain rare, the main reasons for this message are as follows:

  • **Web server outage**: the result received by the **gateway** is negative because the target server is experiencing a **complete outage**. This is possible when there is a system failure.
    
  • Web server overload: the web server may reach its limits, in which case it no longer responds to requests and the gateway displays the 502 error message. This situation is notably caused by an excessively high number of visits, saturating the site's pages. This server overload can also be caused by a DDoS attack aimed at overwhelming server capacity and thereby causing it to fail. This type of attack uses a network of bots.

  • Incorrect PHP code: the error can also come from the website's code. In this case, requests cannot be processed and a negative result is displayed.

  • Communication error: this error originates on both sides — the server side and the client side. Requests are therefore not transmitted.

  • Browser error: browser extensions can cause this error to appear on a website.

How do you make it disappear?

You can report this information to your webmaster, who will take care of making the error disappear if possible. In that case, all you need to do is arm yourself with patience while waiting for everything to return to normal.

However, you can also perform a few actions to see whether you can resolve this error on your own.

1. The basics

Traceroute:

First, you need to check whether your server is functioning as it should. You can start by trying to run a "traceroute".

To clarify, a traceroute is a utility commonly used on any distribution that allows you to follow and retrace the path of a packet from point A to point B on a LAN network as well as on the internet.

This will first tell you whether your server is accessible.

If the server is accessible, this means the problem lies at the end of the path. Otherwise, you will need to turn to your hosting provider to resolve the issue.

Check your DNS:

You should also reset your router and check your Domain Name System (DNS). This is a basic fix that can sometimes make the 502 error disappear, as you can resolve it yourself.

If you see no improvement, you can also try the following solutions.

2. More advanced solutions

Clear the web cache:

The 502 error can appear when you try to access your website. This happens in particular when the browser relies on its cache, or browser cache, rather than loading the latest version of your site.

If you wish to clear your browser cache, you can use CTRL+F5.

This will force your browser to clear its cache, and this action works with most browsers. If it does not work, you will need to clear your browser cache manually. For Chrome users, simply go to "Settings" → "Advanced menu" and navigate to the "Clear Browsing Data" option.

This operation can also be performed by Firefox, Internet Explorer, Safari, and virtually all other browser users.

Once this action has been completed, if the error still appears when loading your page, you will need to move on to more serious measures and consider another solution.

Disable your CDN:

Rest assured, this will be temporary.

However, your browser requests may be routed through a proxy server. The latter is an intermediary between the user's browser and the website's server.

Sometimes the problem can therefore come from the proxy — in which case, simply temporarily disabling your CDN will allow you to see for yourself whether this error is related to it.

You will then need to check that your site loads correctly without it. Moreover, disabling your CDN is a fairly simple action that can tell you more about the origin of your 502 error.

Following this action, if the error disappears, it means it was linked to your CDN. All you will then need to do is wait a few hours before re-enabling your CDN, then check afterwards that the error has gone.

Test your WordPress themes and plugins:

If you have reached this point, it means that the previous steps regarding your server, browser, and CDN have not worked. It also means that the issue is coming directly from your WordPress site.

It is indeed possible that one of your themes or plugins is trying to execute a script that your server cannot load correctly. This can trigger the 502 error.

The process to follow is as follows: since you cannot access your dashboard at this point, you will need to manually disable your plugins and themes.

Important note: disabling them does not mean deleting them, and reactivating them takes only a few moments. The functionality of your website will not be affected.

It may nonetheless be wise to have a fallback option such as a recent external backup in case of any accidental manipulation or need to roll back.

If, following this procedure, you discover that the issue originates from one of the themes or plugins, you can delete it and find a replacement. If it is "outdated", you simply need to update it and then verify that the error has disappeared.

As you will understand having read this article, the 502 error can stem from many causes, and you will need to be patient in order to test all possible solutions and actions to resolve it.

But remember this: if the 502 error appears when loading your site and does not disappear after a few minutes, you will need to work through the following actions in order:

  • Clear your browser cache
  • Temporarily disable your CDN
  • Test your themes and plugins

YOU MAY ALSO LIKE

UGC, the future of marketing: how user-generated content can revolutionise your marketing strategy

by Yumea, 7 March 2023

UGC (User Generated Content) is changing the game in the world of marketing. With the rise of social networks and content-sharing platforms, the … READ MORE

Category: News , Getting visible online , Social media

Comments: 0

How to use Instagram to reach your audience and drive traffic to your website

by Yumea, 1 February 2023

Social networks have become an indispensable tool for businesses looking to reach their target audience and generate traffic to their website. With over 3.8 billion active users … READ MORE

Category: Getting visible online , Instagram , Social media

Comments: 0

7 Artificial Intelligence (AI) tools you need to know in 2023

by Yumea, 12 January 2023

In 2023, there are many websites using artificial intelligence (AI) to help users write content and generate images. If you are looking for tools to help you write … READ MORE

Category: News

Comments: 0

Have a similar project?

Let's talk it over in 15 minutes. No sales pitch, just a technical chat.