LOADING...

WHAT IS A 4XX ERROR?

1 Star2 Stars3 Stars4 Stars5 Stars (23 votes, average: 3.91 out of 5)

If you are a user, encountering a 4XX error for the first time can be quite confusing? It is normal to wonder whether you did something wrong, or if there is something wrong with your computer, and how exactly to fix it.

If you are a website owner, encountering a 4XX error will leave you wondering about its impact on your audience and how best to diagnose and fix the underlying problem.

So, what exactly is a 4XX error? A 4XX Error is an error that arises in cases where there is a problem with the user’s request, and not with the server.

Such cases usually arise when a user’s access to a webpage is restricted, the user misspells the URL, or when a webpage is nonexistent or removed from the public’s view.

In short, it is an error that occurs because of a mismatch between what a user is trying to access, and its availability to the user — either because the user does not have the right to access it, or because what the user is trying to access simply does not exist. As a consequence, communication between the webpage and web server becomes impossible.

What is a 4XX Error

Therefore, this error code is used to indicate problems that a developer or a user should be able to fix.

Understanding HTTP 4XX Client Error Response Codes

All the error codes that fall within the 4XX family are used to indicate errors on the part of the client. They show that the problem that has arisen can be fixed by actions undertaken by the user like changing the request, or providing the appropriate verification.

In general, HTTP 4XX error codes are used to communicate that a problem has occurred on the user’s end. They denote errors that can be easily resolved by simply modifying or completely changing the request that a client is making. The problems that generate these errors have nothing to do with the server.

When Should We Return 4XX or 5XX Status Codes to the Client?

4XX status codes are designed to inform a client that a problem has arisen on their end. They inform them that there is nothing wrong with the server and that in order to resolve the problem, they will need to make changes in the type, form, or content of the request that they are making. In a way, they also communicate the futility of re-transmitting the same request to the server since the error is on the client’s end.

For clients who are familiar with these errors, they are used to give the client a hint as to what they can do in order to fix the problem. For example, a client who gets a 404 Not Found status code will know that whatever they are looking for does not exist and that they should place another request. It may also indicate that the user needs to check for errors in a URL.

On the other hand, 5XX status codes are used to indicate that there is a problem on the server’s side. It tells them that their request is valid and that they didn’t get a response they expected because there was an error with the server. Therefore a 5XX status code communicates to the user that modifying their request is unnecessary. It also hints at the possibility of resolving the problem by simply retransmitting the request. However, in case retransmission does not work, it lets the client know that there is nothing that they can do on their end to resolve it.

A good example of a scenario in which such a status will be returned to the client is when the client is using an API and there is a problem with the database. If the database is corrupted, unreachable, or for any reason fails to work, the client may not be able to save a record. In such a case, a 5XX status code will be appropriate.

It is important to remember to display the error, and to also state the reasons why the request did not go through. This is a good practice because it helps to avoid unnecessary frustration on the part of the client. By letting the user know exactly what went wrong, it will give them an idea of what to expect in terms of solutions.

List of 4XX HTTP Status Codes with Explanation

Here are common examples of status codes that fall within this family.

A 400 Bad Request Status Code

This is a status code that is generated in cases where the server cannot process the request. It indicates that there is a problem in the sense that the request is either corrupted or incorrect and that the server cannot understand the request.

Using GitHub as an example, if you are supposed to use JSON to make a request, but instead opt for a form URL-encoded request, you will get this error. This is because the server will not be able to either receive or parse the request. Therefore, it will give you a 400 Bad Request status code.

To solve the problem that is causing this error code response, all you need to do is to adjust the request.

401 Status Code — Unauthorized Request

This 4xx status code that is generated when authentication fails. It may be that a user has completely failed to authenticate themselves, or that something went wrong with the authentication process. In such a case, the problem can only be overcome once a user has provided sufficient authentication.

402 Status Code –Payment Required

The 402 status code isn’t yet active. It was designed for use in payment situations where access to a resource required payment. However, it is one of the Http error codes 4xx options that haven’t been put to use.

403 Status Code

This code is generated when a user tries to make a request that they are not supposed to make. Therefore, the server prevents the request from going through because the user does not have permission to execute a given operation. In some cases, it is not a matter of permission, but more of a forbidden operation.

The 404 Status Code

This is a common code that is displayed in cases where what the user is looking for is not available. For example, if you use the GitHub API, making a request for a user that is nonexistent will return this error simply because what is being looked for does not exist in the system. The response that you will get from the GitHub server will be in the form of a 404 Not Found error code.

This error is fixable by simply changing the request. Updating the URL so that it references a user that is actually recognized by the GitHub server will get you the right response from the server.

405 Status Code — Method Not Allowed Code

One can configure a web server in such a way that it restricts the methods through which its resources can be accessed. As a result, trying to access the resource using any of the methods that are not allowed will generate this form of nttp 4xx errors. However, in some cases, this error is triggered when a web server hasn’t been configured for access.

406 — Not Acceptable

This is a response one gets from the server in case whatever resource is being asked for exists, but not in a format that the client is asking for. It may be that exists in a different encoding method or different language from what the client is requesting.

407 – Proxy authentication required

You will get this response in cases where there is a need for you to provide a password and a user ID with the proxy server first before being allowed to access a resource. Its an error code that indicates that although the request from the client is correct, proxy authentication is needed. It is one of several http status codes 4xx that are used in cases where authentication is mandatory.

408 — Request timeout

This is a response that is generated in cases where a client fails to make a request within a given window. It is usually an indication of either connectivity problems or the webserver being overloaded. Making the same request at a later time is sometimes enough to solve the problem.

409 — Conflict

The 409 error code is an indication of the existence of a problem with an existing resource. It occurs when the server encounters a conflict that is specific to an application. Getting this error code simply means that in spite of the validity of the request, the request won’t be successful because of a resource’s state.

410 — Gone

This is a permanent version of the 404 error. It usually indicates not only that the resource is unavailable, but also that it won’t be available in the future.

411 — Length Required

When a client gets this error code, it is an indication of a problem with the content length of the request. Therefore, the server declines to accept the request because it has been configured to not accept requests that do not meet a defined threshold. To get the request accepted, all the client has to do is to modify the request by adding valid content.

412 — Precondition Failed

In some cases, a server is configured to accept requests once only certain conditions are fulfilled. If any of the conditions specified as preconditions are not met, then the server will not allow the client to access the given resource. Instead, the webserver will give this error as a response.

413 — Request Entry Too Large

In some cases, a server has limitations on what it is able or willing to process. If a request exceeds this limitation, the server will respond with this error code. It may also keep the client from proceeding with the request by simply closing the connection. A common example is a scenario involving a file upload. If there is a set limitation with regards to file size, the upload may fail and this error will be encountered.

414 — Request URL Too Long

Like the 413 error code, this too is encountered when the request exceeds what the server is willing or able to process. In this case, it is generated when the Request-URL length exceeds the set limit. The limitation on URL length is usually put in place to curb attacks, or to keep the client from descending into an endless cycle of redirection.

415 — Unsupported Media Type

This error occurs when the web server declines servicing a request because the format of the request is not supported by the resource.

416 — Requested Range Not Satisfiable

A client will get this error if he or she makes a request that includes range-specifier values that are beyond the range that is allowed for the resource. For example, if the Range that the client is requesting is 500-1500, and the image file resource has 1000 bytes, then the server will not be able to satisfy this request. It will give a 416 error code.

417 — Expectation Failed

This error code is normally generated when an Expect request-header field is used. If this expectation cannot be fulfilled, then the server will give this error code as a response.

422 — Unprocessable Entity Status Code

This is a status code that indicates that there is a problem with the contents of the request. For example, if you send the right request without including all the fields required to make the request complete.

Unlike the 400 bad request status code that arises due to using the wrong format, with this error code, you are using the right format. The only problem is that the request is incomplete. And so when using the GitHub example, it will arise if you use JSON to make the request, but fail to include a title field.

What does ‘4xx page’ error mean in Site Audit?

You will get a 4XX page error when one or more of the URLs that you are auditing returns an error code that falls within the 4XX HTTP response codes.

In most cases, it occurs because of an unauthorized request, a request timeout, a resource not being found, a forbidden request, or when a client is making too many requests.

This error is an indication of the existence of problems that can interfere with the ability of search engines to crawl your website. These problems will negatively affect the experience of your visitors. And since modern search engines consider user experience as a ranking factor, these problems will affect your rankings in the search results.

Therefore, as soon as you encounter HTTP error codes 4xx, you should immediately remove or replace any links that return a 4XX error since it damages a user’s browsing experience.

How to Fix a 4XX Error

There are several ways to fix HTTP 4XX errors. The first and most common method is to simply check the URL to make sure that you haven’t made any spelling mistakes. In most cases, this is enough to fix a “404 — Not Found ” error.

Clearing cookies and cache can also work in cases where expired or invalid cookies are being used. It is an effective method of solving a “400 — Bad Request” error code.

In other cases, refreshing the page, restarting your computer, or simply trying later, will do the trick.

If you are struggling with solving errors that have to do with the URL, searching the website could help you to resolve the problem faster. Simply use the search box to search for what you are looking for. The search results will most likely contain content with the right URL.

Confirming that you are using the right long-in credentials and that you are using the right URL will help you to avoid most 401 error messages. And if you keep getting constant 4XX error codes, try to access the same website using a different browser or computer. If the errors still persist, you should contact the website.