HTTP ERROR CODES, KNOW THEM AND FIX THEM

HTTP error codes are standard messages returned by web servers to indicate the status of an HTTP request. Although often a source of frustration for users, they provide valuable information for developers and website administrators. Understanding these codes and knowing how to resolve them is essential to maintaining a performant, reliable site that offers an optimal user experience. In this article, we will explore the main HTTP error codes, their causes, and best practices for effectively fixing them, both for a regular user and a developer.
 

What is an HTTP code?

To begin with, HTTP codes (HyperText Transfer Protocol) are status codes returned by a server in response to an HTTP request made by a client (such as a web browser). They help understand the outcome of the request and diagnose potential issues. HTTP codes are divided into five main categories:
 

Code 1XX

Those starting with 1 indicate an informational response from the server. In fact, they neither signal an error nor a success but simply provide information to the client.

Code 2XX

HTTP codes starting with 2 are 10 in total. All indicate a success message from the server regarding a request made to it.

Code 3XX

Those starting with the number 3 are known for their use in SEO. They are used to display redirection messages.

Code 4XX

An HTTP code starting with 4 is used to indicate a client-side error. These errors are therefore not only diverse but also numerous.
 

Code 5XX

The HTTP 500 response status codes are used to indicate a server-side error. However, they are less numerous than the 400 error codes.

In this article, we will focus on 4XX and 5XX error codes. The goal will be to learn about the most common errors and how to fix them.

 

Client-side HTTP errors (4XX)

400 - Bad Request

How does it appear?

When you try to access a website or one of its services, a request is sent to the web server. This error, 400 Bad Request, appears when the server fails or is unable to understand your request. As a result, the request is not processed, and this error message is returned to you instead.

The cause of this 400 error usually comes from the client. It could be due to:

  • A syntax error in the URL.
  • Uploading a file that is too large (some websites have a limit).
  • Cookies or browser cache that may be corrupted.
  • A faulty DNS cache.

How to fix it?

The first thing to do is refresh the page. Sometimes, it’s just a temporary issue with the remote server. Otherwise, depending on the cause of the 400 error, you can:

  • Check the website URL.
  • Clear the browser cache or cookies.
  • Disable browser extensions.
  • Check the file size if it’s an upload issue.
  • Flush the DNS cache.

If the problem persists, you can restart your machine or contact the website owner directly to report the unresolvable 400 error.

401 - Unauthorized

What triggers it?

The 401 Unauthorized error means that the browser cannot access a particular web page because the server received an unauthenticated request. This error may appear, for example, when you try to access a password-protected web page without providing any authentication details. On the client side, the 401 error may be caused by:
  • Entering an incorrect URL.
  • An incorrect username or password.
  • Expired browser cache and cookies.
Sometimes the error is not necessarily triggered by the client but may come from the web server. It is possible that the server is intentionally blocking the client’s access, or the server’s authentication process may be faulty.

How to fix it?

First, check if the 401 error only appears for you or if everyone is affected, to determine whether you are the cause of the error or if it is actually the server.

If the error originates from the client, you can:

  • Check the accuracy of the URL.
  • Clear your browser’s cache and cookies.
  • Flush the DNS cache.
  • Verify your authentication details (make sure they are correct).
  • Contact the site owner.

If it’s your site and you’re trying to fix the issue, try:

  • Disabling password protection (at least temporarily).
  • Checking for errors or omissions in the WWW-Authenticate header.
  • Disabling plugins, modules, and themes (if you’re using a CMS).

403 - Forbidden

What the difference with 401 ?

If the 401 error occurs when a server does not receive valid authentication data, the 403 error appears when the server does not allow access to a specific part of the website even with valid authentication data provided. It can also involve geoblocking to restrict access to IP addresses from certain countries or regions.

What’s important to remember about the 403 error is that, this time, the client cannot do much about it, as it is an access restriction. However, it is possible to try:

  • Disabling the Adblocker and clearing the cache.
  • Disabling browser-installed plugins.
  • Refreshing the page.
  • Checking the website URL.

These actions may not always resolve the issue. The simplest option is to contact the site administrator to inquire about access rights to certain services.

404 - Not Found

Where does it come from?

The famous 404 error occurs when the HTTP server cannot find the requested resource. Either the web page being searched for does not exist, or it no longer exists. This can happen if the original website has undergone a redesign or migration, and the URL is no longer the same.
 

What to do about the 404 error?

The client cannot do anything about a 404 error. If it’s due to a redesign or migration, it is their responsibility to find the new address of the site they were looking for. Try performing a search through the browser.

As for a 404 error that appears on a website when clicking on a link, it is the webmaster’s responsibility to check the URLs behind the link. It’s important to ensure that the URL leads to an existing page. Regularly check if these links point to external sites, as we are never safe from a redesign, migration, or the removal of a web page.

407 - Proxy Authentication Required

What is it?

The 407 error occurs when the server is unable to complete a request due to a lack of information when a proxy server is used between the client and the server. As a result, the 407 error appears when the proxy cannot authenticate the client. This error is similar to the 401 error, but in this case, it involves a proxy server acting as an intermediary between the client and the web server.
 

How to fix 407 ?

Since three different parties are involved, several solutions need to be tried to resolve the issue. However, if the problem stems from the proxy itself, it will be difficult to address. But before that, let’s look at what can be done on the client side, then on the server side.

The first thing to do is check if the 407 error occurs on just one device or all your devices. If the error only appears on one device, it could be due to a security program on that device. If not, check your proxy configuration in your web browser. The last thing you can check as a client is the website URL. Otherwise, contact the website owner.

If your site is displaying this 407 error, here’s what you should try:

  • Disable plugins (if you’re using a CMS), as some might be causing the issue.
  • Review and undo any recent changes.
  • Check the error logs.
  • Inspect the server configuration files.

408 - Request Time-out

What is the cause?

As the name suggests, the 408 error occurs because the request sent by the client to the web server took longer than the server allows. Most of the time, this error happens on the client side due to bandwidth issues or connection interruptions. However, there can be other reasons on the server side, such as:

  • Server misconfiguration.
  • Cumbersome plugins, extensions, modules, or other elements (if using a CMS).

How to fix the 408 error?

If it’s a client-side issue, you can only refresh the page, disable browser extensions, or simply wait for better bandwidth.

However, for the webmaster, it’s important to:

  • Check the web server configuration.
  • Review the log files and modify any problematic pages.
  • Disable any outdated or faulty modules, themes, or plugins that might be slowing down the CMS if applicable.
  • Check and fix the code.
  • Increase the server’s resources.

415 - Unsupported Media Type

What is the 415 error?

This error occurs when trying to upload a media file to a website, and the site is not configured to support that specific file type. Of course, this is beyond the client’s control.
 

What should the Webmaster do?

It is up to the Webmaster to establish the necessary conditions to prevent this error from appearing, while clearly informing users about which file types are allowed or not. This greatly reduces the risk of errors.
 

429 - Too Many Requests

Why does it appear?

The 429 error occurs when the server receives too many requests in a short period of time. It could be caused by a user accidentally sending multiple requests, but most of the time, it may be due to a hacking attempt. When such a situation arises, the system drastically limits the rate and triggers the 429 error as a security measure to block everything. This error most often appears on a website’s login page, which can remain blocked for a long time by the 429 error if the attacks continue.
 

What can be done to fix this error?

Unfortunately, it is not possible to completely prevent this situation from occurring. However, you can better prepare for it by:

  • Using a content delivery network (CDN).
  • Optimizing the database for better request handling.
  • Configuring rate limits.
  • Monitoring CPU and memory usage.

Despite these measures, if you cannot avoid these situations, your best option is to contact your web hosting service to see if additional security layers are available.

If you have a WordPress site, there are several solutions available to protect against cyberattacks.

Server / Application Server Errors (5XX)

500 - Internal Server Error

What is it?

This error indicates an internal server problem. The 500 error signals a malfunction of the hosting service or the website. To identify the cause of this error, first check if the error affects all users. If the site is unavailable for everyone, the issue is related to the server. Otherwise, the error likely originates from the website itself.
 

What to do?

If it turns out that you are not the only one affected by this 500 error and it impacts all users, contact the hosting provider as the website owner if the server is unavailable. Otherwise, you should:

  • Increase the available resource limits.
  • Fix the .htaccess file.
  • Remove or fix problematic scripts.
  • Check the files and directories.
  • Disable plugins (if using a CMS).
  • Check the site’s theme (if using a CMS).

502 - Bad Gateway ou Proxy Error

What is the 502 error?

The Bad Gateway error (or Proxy Error) indicates that the server you are trying to connect to received an invalid response. Many different factors can cause the 502 error, such as:

  • An unresolved domain name.
  • Overload of the origin server.
  • Browser errors caused by extensions.
  • Issues with home network equipment.
  • A blocked firewall.
 

How to fix this error?

The 502 error on the client side, as mentioned earlier, can be due to server overload, browser issues, or network problems. You can try the following:

  • Reload the page (give the server some time).
  • Use a different browser.
  • Switch to incognito mode.
  • Test on another device.
  • Clear your browser cache.
  • Check for DNS issues.

However, if it’s your website and the problem persists, and it’s not a temporary issue due to site overload, you should:

  • Contact your hosting provider.
  • Temporarily disable the CDN or firewall.
  • Check for PHP timeout issues that might be causing an overload.

503 - Service Unavailable

What is the cause?

One of the most well-known web errors, the 503 error occurs when a server is unable to provide the requested resources. It is fairly common and is caused by a few common reasons, such as:

  • The server is undergoing maintenance and is unavailable.
  • The server is overloaded.
  • DNS configuration issues (though rare).

How to prevent it from happening?

Being mostly a temporary error, there’s not much a user can do besides the usual steps:

  • Refresh the page.
  • Visit the site later.
  • Restart the computer or change DNS servers if the issue stems from there.
  • Contact support or the site administrator for more information.

For the website operator, the best approach is to prevent this error as much as possible. This can be done by either customizing the 503 error page to provide information about the cause or taking steps to avoid the error. To do so, it’s important to:

  • Monitor the necessary hosting resources.
  • Regularly update the software.
  • Detect and resolve programming errors as early as possible.

504 - Gateway Time-out

Why does it appear?

The 504 error occurs when an intermediary server or a network interface fails to respond to the browser’s request. There can be various causes behind this error, such as:

  • The user’s proxy server or local network is overloaded and no longer functioning. If this is the case, the 504 error will appear on many pages.
  • The proxy server used by the website is overloaded or malfunctioning.
  • Incorrect proxy settings.
  • The issue may affect one or more websites from an internet service provider.

What can be done to fix the 504 error?

As mentioned earlier, this error is mainly due to a proxy or network interface issue. If you are a user without a proxy and encounter the 504 error, you can:

  • Try accessing the website again (refresh the page).
  • Restart your network devices.
  • Change your DNS server.
  • Contact the website administrator.
  • Try again later and check the site again.

If you use a proxy, make sure to check your proxy server settings.

Finally, if you are the owner of the site facing this 504 error, you can:

  • Increase the resources of the proxy server.
  • Adjust the proxy server settings.
  • Contact your hosting provider or internet service provider.

Knowing how to react to HTTP errors.

In summary, understanding and managing HTTP error codes is essential to maintaining a performant and reliable website. These codes, whether informational, success, redirection, client error, or server error, provide valuable insights into the status of HTTP requests and corresponding responses. Knowing the meanings of the most common codes, such as the 404 (Not Found) or 500 (Internal Server Error), not only allows for quick problem diagnosis but also helps optimize the user experience. It’s important to note that HTTP error codes negatively impact your website’s SEO, so they should be quickly identified and resolved.

Whether you are a developer, system administrator, site manager, or simply a user, investing time in understanding and resolving HTTP error codes is a step toward a more stable and efficient web environment.

Three ideas to remember:

Find the cause

Finding the exact cause of an HTTP error is the key to resolving it. Using tools like the site Down For Everyone Or Just Me is a step forward in investigation and understanding.
 

Act quickly and efficiently.

Once the cause is found, it is important to address it promptly. Don’t hesitate to contact the site owner or your web host directly. Finding a quick solution to the problem helps prevent further consequences.
 

Understanding HTTP Error Codes

Mastering the different HTTP error codes is essential for quickly diagnosing issues and improving the user experience. Whether you are a regular user or a webmaster, studying and understanding HTTP error codes is the best way to prevent them in the future.
 
OPTIMUM CIRCLE » SEO » HTTP ERROR CODES, KNOW THEM AND FIX THEM