HTTP Status Codes Explained

HTTP Status Codes Explained

In this article, we would be discussing all of the HTTP Status Codes, what are they, how are the categorized, what each category contains and meaning of each and every status code. 

HTTP Status Codes | Full Stack Geek

Table of Contents

What are HTTP Status Codes:

In a Client-Server architecture, you (the Client end) receives various types of responses and to identify each of them, these HTTP Status Codes are divided into various categories. Each status code is a 3 digit number of which, the first digit determines the category and the rest two digits really gives the meaning to these HTTP Status Codes which we will be seeing in the following sections.

Suggested Read: PHP Cookies and Sessions | Detailed Explanation | Coding Examples

Categorization and Detailed Explanation of all HTTP Status Codes:

In this section, we would be discussing each and every HTTP Status Code along with their respective categories.

1XX – Informational:

This class of HTTP Status Codes simply means that your request is received and the work is under process. It indicates only a provisional response. They consist of only the Status Line and some optional header and nothing else. As a matter of fact, HTTP/1.0 did not define any 1XX HTTP Status Code.

HTTP Status CodeDescription
100 ContinueIt means that the client should continue with its request and is used to give an interim response to the client that the request has been received and has not been rejected by the server.
101 Switching ProtocolsWhen the client requests for a change in the application protocol being used on this connection, the server responds with this status code if Server is willing to change the protocol as per request.

2XX – Success:

This class of HTTP Status Codes indicates that the request from the client was received, understood, accepted and processed successfully.

HTTP Status CodeDescription
200 OKIt means that the request from the client is OK.
201 CreatedIt means that the request is complete, and a new resource is created, where the newly created resource can be referenced through the URL(s).
202 AcceptedIt means that the request from clients accepted for processing, but the processing is not yet complete.
203 Non-authoritative InformationIt means that the returned set of meta information in the entity-header is not the same as the set as available from the origin server, but is obtained from a local or a third-party copy. The set presented MAY be a subset or superset of the original version.
204 No ContentIt means that the server returns a status code and a header is given in the response, but there is no entity-body in the response whatsoever.
205 Reset ContentIt means that the server successfully processed the request, but is not returning any content. This response requires that the client reset the document view.
206 Partial ContentIt means that the server is returning partial data of the size requested by the client.

Suggested Read: Var vs Let in JavaScript



3XX – Redirection:

This class of HTTP Status Codes indicates that further action needs to be taken by the user agent in order to fulfill the request. A client must be able to detect infinite redirection loops.

HTTP Status CodeDescription
300 Multiple ChoicesIt means that the server responds with a link list. The client can then select a link and go to that location. Maximum five such addresses are allowed.
301 Moved PermanentlyIt means that the URL requested by the client has now been moved to a new URL.
302 FoundIt means that the URL requested by the client has been TEMPORARILY moved to a new URL.
303 See OtherIt means that the response to the request can be found under a different URI and should be retrieved using a GET method. The new URI is not a substitute reference for the originally requested resource.
304 Not ModifiedIt means that this is the HTTP Status code to an “If-Modified-Since” or “If-None-Match header”, where the URL has not been modified since the specified date in the request from the client.
305 Use ProxyIt means that the requested URL must be accessed through the proxy as being mentioned in the Location header.

4XX – Client Error:

The 4xx class of status code is intended for cases in which the client seems to have erred.

HTTP Status CodeDescription
400 Bad RequestIt means that the Server did not understand the request from Client.
401 UnauthorizedIt means that the requested resource is username/password protected.
402 Payment RequiredThis code is reserved for future use.
403 ForbiddenIt means that accessing the requested page is forbidden.
404 Not FoundIt means that the Server is unable to find the requested page.
405 Method Not AllowedIt means that the method sepcified in the request (Get or Post) is not at all allowed.
406 Not AcceptableIt means that the server can only generate a response entities that is not accepted by the client as client always specifies them under accept headers.
407 Proxy Authentication RequiredIt means that the client must authenticate via a proxy server well before this request can be served by server.
408 Request TimeoutIt means that the request from Client took time greater than the Server was configured to wait.
409 ConflictIt means that the server can not complete the request because of a conflict.
410 GoneIt means that the requested resource by the client is no longer available at the server and no forwarding address is known to the server.
411 Length RequiredIt means that the client has not defined the “Content-Length”.
412 Precondition FailedIt means that the precondition as specified by the client has been evaluated as false by the server.
413 Request Entity Too LargeIt means that the request entity is too large and hence the server will not accept the request.
414 Request-url Too LongIt means that the URL is too long that the Server can not accept the request. It arises majorly when the client tries to convert a POST request to a GET request.
415 Unsupported Media TypeIt means that the media type is not supported and hence the server will not process the request.
416 Requested Range Not SatisfiableIt means that the requested byte range is out of bounds now.
417 Expectation FailedIt means that the contents of Expect request-header can not be met by the server.

5XX – Server Error:

This class of HTTP Status Codes indicates that the server failed to fulfill an apparently valid request.

HTTP Status CodeDescription
500 Internal Server ErrorIt means that the request can not be served as the server met with an Exception.
501 Not ImplementedIt means that the request can not be served as the server itself does not support the functionality requested by the client.
502 Bad GatewayIt means that request can not be served as the server has received an invalid response from upstream server itself.
503 Service UnavailableIt means that the request can not be served as the server is down or may be temporarily overloaded.
504 Gateway TimeoutIt means that request can not be served as the gateway has timed out.
505 HTTP Version Not SupportedIt means that the request can not be served as the server does not support the requested version of “http protocol”

Recommended Articles:

If your learning appetite is still left, you are suggested to read below articles:

References

So this was all about the HTTP Status Codes and now, we would be listing down the references used to write down this article.

Leave a Reply