In the world of web development, HTTP error codes play a vital role in affecting the user experience and reputation of a website. In this article, we will consider a complete list of server error codes, analyze their meanings, and learn how to effectively interpret server response codes in order to solve problems and optimize the web apps performance.
What is an HTTP response code
HTTP response code is the language of web servers that translates browser requests into understandable instructions. It is like a poet answering virtual questions, giving them meaning and direction. Response codes are not always HTTP error codes. For example, “200 OK” means everything is OK, but HTTP Error “404 Not Found” means when the page is lost in the virtual space. Each code is a unique expression of the server state, the decoding of which allows us to understand what is happening on the other side of the virtual world.
1xx codes (Information)
1xx status codes in the HTTP protocol are a kind of first link in the dialogue between the server and the client. Instead of providing a complete response to a request, they provide information about the current status, making data exchange more efficient. Let's take a closer look at them:
100 Continue. HTTP response code in which the server gives the green light to the user, allowing him to safely continue sending a large request.
101 Switching Protocols. The server tells the client that it is changing the rules of the game, for example, moving from HTTP to the more secure HTTPS. In this case, the “Upgrade” header is used for the protocol change.
102 Processing. This code is like a message that the server has accepted the request, but is still busy with a complex operation.
103 Early Hints. Here the server sends several indicative headers to the client before the main response, warning about something that may be relevant in the near future.
2xx code (Successful)
HTTP error codes in the group 2xx indicate a successful request from the server. They essentially act as a “green light” in the scope of web communications, confirming that everything is going according to plan and has been successfully completed.
200 OK. This status is used when the server processes a request by GET method without problems and returns the requested data in response. The "Content-Type" header reports the content type in the response. It just informs the client that the request was successful.
201 Created. Here the server announces the creation of a new resource.
202 Accepted. The server lets the user know that the request has been accepted, but will take time to respond.
203 Non—Authoritative Information. This code provides the client with data that may not be official, but can be used for comparison.
204 No Content. The server has processed the request but is not returning any additional content.
205 Reset Content. Here the client is instructed to reset the current view or data after sending.
206 Partial Content. This case indicates that the response contains only part of the requested content. The "Content-Range" header indicates the partial content range.
207 Multi-Status. The server has successfully completed a multi-operation request from the client, and the response contains information about the status of each of the operations.
226 IM Used. This code indicates that the server used the Incremental Metadata (IM) method and responded by passing only the modified resource parts to the client.
3xx codes (Redirects)
3xx codes in the HTTP protocol are like pointers that guide the user to a new resource location. They inform the client that follow-up steps must be taken to obtain the requested content or to be redirected to another resource. Let's immerse into the details of each of them:
300 Multiple Choices. The client receives a signal that there are several possible locations for the resource and is given a choice in response. In current circumstances, the "Location" header may indicate alternative options for the resource.
301 Moved Permanently. The server reports back to the user that the resource has been permanently moved to another location.
302 Found. This HTTP code is similar to a temporary redirect. The server informs the consumer that the resource is temporarily available at a different URL. The "Location" header points to the new URL for the temporary redirect.
303 See Other. The client is told that the resource is available at a different URL and must make a GET request to this new address.
304 Not Modified. This status tells the client that the resource has remained unchanged since the last request and does not need to be downloaded again. When making a request, the "If-Modified-Since" header is used to check if the resource has been modified.
305 Use Proxy. As a response, the server reports that it should use the specified proxy to access the requested resource.
306 (reserved) — The code has been reserved, but in fact it is not used.
307 Temporary Redirect. This code is similar to 302 Found, but requires the client to remain in the request method that was used in the original request.
308 Permanent Redirect. Indicates that the resource has made a permanent move to a new URI and the client should use the new URI for all future requests.
4xx HTTP Error (Client errors)
HTTP 4xx error codes indicate client errors. This means that the problem is on the user side, such as the web browser or app.
400 Bad Request. The server cannot process the request due to syntax errors, invalid data, or other errors on the client side.
401 Unauthorized. The server cannot process the request due to syntax errors, invalid data, or other errors on the client side.
402 Payment Required. The code is not active at the moment and is reserved for future use. It may indicate the need to pay before accessing the resource in the future.
HTTP Error 403 Forbidden. The client does not have sufficient rights to access the requested resource.
404 Not Found. The requested resource does not exist on the server. This is one of the most common user errors.
405 Method Not Allowed. The server does not support the specified request method in during this resource. The “Allow” header indicates the allowed methods for the resource. With this code,
406 Not Acceptable. The server cannot provide data in a format that can be accepted by the client.
407 Proxy Authentication Required. Authentication on proxy server is required for access the requested resource.
408 Request Timeout. The server was waiting to receive a request from the client, but timed out. The "Retry-After" header may indicate the time after which the request can be retried.
409 Conflict. The request cannot be completed due to a conflict with the current resource state.
410 Gone. The requested resource previously existed but has now been deleted and its restoration is not expected.
411 Length Required. The server demands to specify the content length in the request; the absence of this information is considered an error.
412 Precondition Failed. A precondition in the request is not met, that prevents it from executing.
413 Payload Too Large. The size of the request data exceeds the server limits.
414 URI Too Long. URI length in the request exceeds acceptable limits.
415 Unsupported Media Type. The server cannot process the data type provided in the request.
416 Range Not Satisfiable. HTTP error where the requested range does not match the current server data.
417 Expectation Failed. The expected condition in the "Expect" header was not met.
418 I’m a teapot. This code is included as a joke and does not imply any real action for the user or server, and is not a full-fledged error. It indicates that the server is a teapot and is not capable of making coffee.
421 Misdirected Request. The server does not process the request due to an error in the request or server configuration.
422 Unprocessable Entity. The server understands the request, but does not process it due to data errors.
423 Locked. The resource is blocked and cannot be processed.
424 Failed Dependency. The request depends on another unexecuted request.
425 Too Early. The server is not ready to process the request due to its early coming.
426 Upgrade Required. The server requires the use of a more advanced protocol to process the request.
428 Precondition Required. The server requires certain preconditions to be specified in the request.
429 Too Many Requests. The client sent too many requests in a short time, exceeding the server's limits.
431 Request Header Fields Too Large. Request headers exceed the maximum allowed size.
449 Retry with. Indicates that the request cannot be run by the current server, but can be successfully processed by another server, and the client should retry the request with a new URI.
451 Unavailable for Legal Reasons. The resuource is unavailable for legal reasons.
499 Client Closed Request. The server received the request, but the connection was closed by the client before processing completion.
HTTP 5xx error (Server errors)
HTTP 5xx error codes indicate the server problems. These codes indicate problems that have occurred on the server side, making the server unable to process the user's request in a right way. Let's take a closer look at them:
HTTP Error 500 Internal Server Error. The server encounters unexpected circumstances that prevent it from the request completion The "Server" header may indicate the server on which the error occurred.
501 Not Implemented. The server does not support the functionality required to process the client's request. The "Via" header may indicate the proxy server through which the error occurred.
502 Bad Gateway. This code means that the server that acts as proxy received an incorrect response from another server.
HTTP Error 503 Service Unavailable. The server is temporarily unable to process requests.
504 Gateway Timeout. The server, that acts as proxy, did not receive a timely response from another server.
505 HTTP Version Not Supported. The server does not support the HTTP protocol version specified in the request. As a backup option, the "Upgrade" header may indicate supported protocols.
506 Variant Also Negotiates. This status is not used in HTTP/1.1; however, if the server detects an internal configuration that results in content negotiation ambiguity, it may use this response.
507 Insufficient Storage. The server cannot fulfill the request due to insufficient storage space on the server.
508 Loop Detected. The server has detected a loop while processing the request, and refuses to complete the request in order to avoid an infinite loop.
509 Bandwidth Limit Exceeded. The error occurs when the server's bandwidth is exceeded due to high volume of requests or traffic.
510 Not Extended. The client must transfer additional extensions to continue the request.
511 Network Authentication Required. The client must authenticate itself in order to gain access to the network.
How to check the page status code
In this section, we'll give consideration to three main ways to check the page status code: via the command line, using a web browser, and using independent online services. Each of these methods has its own advantages and can be useful in different situations.
Checking server response via command line
The command line provides a convenient way to check the page status code without having to use a web browser. For this method, you need to open the command line and use the command:
curl -I http://page-address
This command sends a HEAD request (headers only request) to the specified URL and displays information including the HTTP status code:
The example above shows a successful response code. In the case of a response that contains an error code, such as 404 Not Found HTTP error, the result will look similar:
Checking the server response via the browser console
The web browser developer console provides tools for conducting various operations, including checking the page status code. In order to see the HTTP code in the server response, you need to open the developer console (Ctrl+Shift+K) or (Ctrl+shift+J) depending on the browser used. Next, select the “network” section and load the desired page:
Checking the server response using independent tools
There are a large number of independent online services that provide tools to check the website page status code. These services usually allow you to quickly receive an overview of your resource's availability and performance. They all operate using the same principle. As an example, we will consider the most popular resource - httpstatus.io
First of all, you need to open the service itself, then enter the address of the page which answer you need to find out, and request verification:
The result will be displayed at the bottom of the page:
Conclusion
In conclusion, it should be emphasized that understanding and being able to read HTTP error codes is a key skill for anyone involved in web development and server maintenance. As we figure out each error and explore the tools to detect them, we see reasons why it is so important to effectively manage these web services aspects.