What is an HTTP code?
Code 1XX
Code 2XX
Code 3XX
Code 4XX
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?
- Entering an incorrect URL.
- An incorrect username or password.
- Expired browser cache and cookies.
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?
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?
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?
What should the Webmaster do?
429 - Too Many Requests
Why does it appear?
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?
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.