All 4xx Error Status Code and Fixes

Web server side errors is the error that affects the client side of your website. It is an error that may occur when a webpage doesn’t exist or has restricted access or rights. It is a HTTP status code that occurs when request cannot be exchanged between the web page and web server. So we wish to discuss the 4xx errors like 400, 401, 402 and others in the class of 4** and how some of them can be solved by you while others you need to contact your web hosting company.

All 4xx Error Status Code and Fixes

We wrote a post before now on “causes and fixes to 406 server error“. When i encountered 406 in one of the website i was developing for a client, i called my host service provider but they did not fix it because they did not really know what to do (No offense but some of the workers in some web hosting providers do not about some issues) when certain issues occur but if you know what the problem is and how to fix it, you can tell them and they will fix it.

That is what happened in the 406 error, i worked with them and told them possible issue and what to do and they did it, “wawu!” it was fixed.

Today let us know all the HTTP status 4xx error codes and some possible solutions. See below for details

Read Also: How to fix 500 internal server error

4xx – Client Error

This is a family of HTTP status codes that occurs when the request for a resource has bad syntax or can’t be found or cannot be filled for some other reason, presumably by fault of the client sending the request.

1. 400 – Bad Request

This is a status code that occurs when a server cannot process the request due to syntax errors. It simply means that the web server was unable to understand the request and to process it because the request sent by the client (browser) was not formed properly and did not conform with HTTP protocol standards.

2. 401 – Unauthorized

This HTTP status code error indicates that the file you requested requires authentication (eg: a username and password). When you provide credentials that the server rejects, you immediately see a 401 error. This simply means that one or both of your username and password were invalid.

3. 402 – Payment Required

This is a HTTP status code error that is not active yet as it was intended to be used for digital payment. It has not been put to use funny enough

4. 403 – Forbidden

It is a status code that denies access to visitors to the requested file. It does not mean that the request the client sent to the server was ilegal rather the server just decides that it wont respond or process it. No authorization can solve this.

A major thing to do is to check the file’s permission settings, or check whether the file has been protected.

5. 404 – File Not Found

This is a HTTP status code which shows that the server could not find the file that the visitor(user) requested for. It may be due to mistyped url or the page has been removed or url changed.

Please do not confuse 404 error with “server not found” or similar errors. The later relates more to connection to the destination server cannot be made at all.

How do I Fix a 404 Error?

  • Redirect the page: You can perform this task using a 301 redirect.
  • Correct the link. Sometimes, people can simply mistype a URL. If this is what happened with your 404 error code, make sure you go back and fix the URL.
  • Restore deleted pages

6. 405 – Method Not Allowed

HTTP protocols defines web servers. For a user to access the resources on the web server, it must have access to this web resources. When the request of the user is not allowed to the web server resources, you will get a 405 error. Sometimes, this error is triggered when a web server hasn’t been configured to grant access.

This can mean that the web server is not configured to accept requests from visitors at all. This can be found when trying to send info with the POST method in forms.

Note: All 405 errors are recorded in the server logs and you can contact your hosting service provider to explain them.

7. 406 – Not Acceptable

This is a status error code that indicates when there are different encoding methods or different languages from that which the client is requesting.

The header with the 406 error code can be displayed if the web server detects that the only response it can generate and return to the client is not acceptable by the client. Full details in causes and fixes to 406 server error

8. 407 – Proxy Authentication Required

This is an error code similar to 401 error above. The client need to authenticate the server proxy with user ID and Password before it can have access to the resources on the server.

9. 408 – Request Timeout

This is a HTTP status code that occurs when the client fails to make a request within a given window. This is as a result of the web server being overloaded or there is a connectivity problem.

Solution: Check connectivity and secondly check the workload on your web server at the times when these errors were observed.

10. 409 – Conflict

This is an error code that comes in to play when the web server encounters a conflict with a specific application. It means that when the client requested for a resources from the server, it was found but request was not able to be completed due to conflict.

It can be due to application conflict that were not defined in the HTTP protocol.

11. 410 – Gone

This HTTP status error is similar to 404 error just that 410 error is permanent. It means that the resource which the client requested for is no more available on the server. It can be said to mean that such request (content) will not be available in future.

12. 411 – Length Required

This is when there is a problem with the content length of the request, hence server declines the request. This can be fixed when the client modifies the the request by adding a valid content length header field in the request message.

13. 412 – Precondition Failed

412 error occurs when the client sets up specified conditions in the request-header fields and when some of the predefined conditions are not met, the server will not allow the client to access the given resource.

14. 413 – Request Entity Too Large

This is a HTTP status error that occurs when a request made from a client is too large to be processed by the web server. This is when there is a limitation on the server to process a request.

For example a request to upload a very large file (via the HTTP PUT method) may encounter a limitation on upload file size set by the Web server.

15. 414 – Request-URL Too Long

This is an error that occurs when the URL requested by the client is longer than the server is willing to interpret. According to Mozilla developers, there are three reasons why you get 414 error displayed:

  • when a client has improperly converted a POST request to a GET request with long query information,
  • when the client has descended into a loop of redirection (for example, a redirected URI prefix that points to a suffix of itself),
  • or when the server is under attack by a client attempting to exploit potential security holes.

How to fix 414 error

  1. Use POST with a form (or an hidden form and add onclick event at your link that submit it)
  2. Use Session. When the server generates the link, store it in $_SESSION with an unique id (or RID, it can be md5 of complete URI) and pass it via GET.
  3. Use Database or file storage (with the same procedure of session)

16. 415 – Unsupported Media Type

This is an error that indicates that the server refuses to accept the request because the payload format is in an unsupported format. Problem may be due to content-type or content-enoding or direct inspection of the data.

How to fix 415 HTTP error

Possible things to try when you wish to resolve 415 errors include:

  1. Ensure that you are sending the proper Content-Type header value.
  2. Verify that your server is able to process the value defined in the Content-Type header.
  3. Check the Accept header to verify what the server is actually willing to process.

17. 416 – Requested Range Not Satisfiable

This is a server error that indicates that a server cannot serve the requested ranges. The most likely reason is that the document doesn’t contain such ranges, or that the Range header value, though syntactically correct, doesn’t make sense

18. 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.

19. 422 — Unprocessable Entity Status Code

Conclusion

From the above errors, you can see the codes and what they mean. This can help you know how to research for answers. We will also try to write details for the different 4xx errors enumerated here. Some of the solutions are listed above but the details will be given in further post coming soon. Just know that whatever the 4xx errors, you can have idea of what to do or better still call your hosting service provider to resolve it permanently.

Trust this post has been helpful, kindly share and give us a mention online. Thanks

Spread the love
  • 1
    Share

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!