Internet uses HyperText Transmission Protocol or HTTP to send and receive data. When a web server receives a request from a web browser, it sends a three digits HTTP code as a response. This happens for each single request a server receives. Each code in the HTTP response indicates different meaning and in this article let us explore the complete list of 4xx status codes with its meanings.
Types of HTTP Status Codes
Before going to 4xx status codes, it is better to understand we can classify HTTP response codes into the following five categories:
- 1xx status codes for informational purposes
- 2xx status codes for successfully processing of a request
- 3xx status codes for redirection to inform the requested resource is available in different location on the server
- 4xx status codes for client errors primarily comes from the browser due to missing parameters to access the requested webpage
- 5xx status codes for server errors indicating failure in processing of the request
HTTP 4xx Status Codes
A web server sends 4xx HTTP status code in the response when there is an error in the request received from the client. From troubleshooting purposes, you can assume 4xx code indicates the server can’t process the request because the browser sent a wrong request with an error. You need to check the browser and send the correct request again to get the proper response. For example, entering correct username and password for accessing password protected pages. Here is a complete list of HTTP 4xx status codes with explanation. Remember, these are status codes (and not error codes), which may indicate error in some cases while simply provide information in most cases.
4xx Status Code | Description | Explanation |
---|---|---|
400 | Invalid Request | The web server cannot fulfill the request because of incorrect syntax. As a result, it sends a code “400 – Bad Request” in a response. |
401 | Unauthorized Request | You will receive a code “401 – Unauthorized” in a server response when a user tries to access an authenticated resource. It indicates the server is yet to receive an authentication or received incorrect authentication. Simple example is a user trying to access an authenticated webpage by providing wrong user id or password. |
402 | Payment Required | This code was created to use during an online payment is required but currently not used for that purpose. Some servers use 402 code for different purposes like to inform too many requests received from a particular IP address. |
403 | Access to Resource Forbidden | “403 – Forbidden” code is received when a server receive a valid request but deny to respond. This is different from the “401 – Unauthorized” whereas the request needs to be authorized with a password, but authentication will not have any impact in 403 code. An example for 403 code is a registered user trying to access a restricted page. |
404 | Resource Not Found | The “404 – Page Not Found” error code is displayed when a requested resource is no more available in the server. The reason could be that the site owner deleted the page or changed the URL without setting a 301 redirect. The requested resource may or may not be available in future, hence further requests for the same resource is permitted. |
405 | Method not allowed | “405 – Method Not Allowed” is an error received if the request method mentioned in the request is not supported for the resource. If a search engine crawler encounters this error then the URL will not be indexed. |
406 | Not Acceptable Request | When the requested resource exists but in different format then the server responds with the code “406 – Not Acceptable”. The reason for not supporting could be the language or encoding method mentioned in the request. |
407 | Firewall, Proxy Authentication Required | Proxy server authentication is required for the client itself and the code “407 – Proxy Authentication Required” is received. |
408 | Request Timeout | Server should receive the request from client within the specified time. If the client did not send the complete request within the specified time then the server responds with the timeout error “408 – Request Timeout”. |
409 | Conflict | When the request received by the server is in conflict with another request received or with server configuration then code “409 – Conflict” is received. |
410 | Resource Unavailable | When a requested resource is permanently deleted from the server then the code “410 – Gone” is received. The difference between 404 and 410 is that the pages with code 404 can still be requested multiple times but the pages with code 410 should not be requested again. Search engines will remove the pages with 410 error code from the indices whereas pages with code 404 will be requested again by the crawlers. |
411 | Length Required | When the request is sent by the client without mentioning the content length which is required then the server rejects the requests with the reason code as “411 – Length Required”. The request header needs to be corrected and transmitted to the server in order to get a correct response. |
412 | Precondition Failed | If a server encounter a discrepancy on preconditions during processing of the request header then returns the ode “412 – Precondition Failed”. |
413 | Request Entity Too Large | The HTTP status code 413 is received when the server rejects a request due to the reason that the received request is too long for the server to process. |
414 | Request URL Too Long | The HTTP status code 414 is received when the server rejects a request due to the reason that the URL of the requested resource is too long for the server to process. |
415 | Unsupported Media Type | When the request body contains a media type which is not supported by the server then server rejects the request and the code “415 – Unsupported Media Type is received”. For example when a user try to submit a form along with an attachment which is not supported by the server then the upload will fail and code 415 will be received in the server response. |
416 | Requested Range Not Satisfiable | When the range field in the header of the request is not acceptable by the server then the server rejects the request and sends the code “416 – Requested Range Not Satisfiable”. |
417 | Expectation Failed | When the Expect field in the request header does not match the server’s expectation then the code “417 – Expectation Failed” is received. |
418 | I’m a Teapot | This is part of HyperText Coffee Pot Control Protocol created as an April fool’s joke. It indicates a web server denies to brew coffee since it is a teapot. Some web servers returns 418 when they do not want to process the request. |
422 | Unprocessable Entity | When the server can’t process one or more elements in the received request then the code “422 – Unprocessable Entity” is received. |
423 | Locked | When the requested resourced is locked by another request then the server rejects the request and sends the code “423 – Locked” in the response. |
424 | Failed Dependency | When the server rejects the request due to the failure of the previous requests then the code “424 – Failed Dependency” is received. |
426 | Upgrade Required | When the server requesting for a connection upgrade which is not supported by the client then the code “426 – Upgrade Required” is received. |
Non-Standard 4xx Status Codes
In addition to the above listed 4xx status codes, some web servers also use few other non-standard 4xx codes in HTTP response. Some of the examples are as below:
- 420 – Enhance Your Calm: Twitter uses this code in searches when a user sends too many requests within a short period.
- 444 – No Response: You can see this code in Nginx server logs when the server does not return any response and closed the connection for the client.
- 451 – Redirect: Microsoft’s Exchange ActiveSync uses this code when the server can’t access user’s mailbox.
You can download the free HTTP status codes guide to understand all types of codes available in a server response.
4 Comments
Leave your reply.