HTTP Status Codes

HTTP is a stateless protocol where the session is managed by the upper-level applications. But HTTP protocol provides the status codes about the HTTP request. Every HTTP request will be responded by an HTTP status code from the remote site or server. In this tutorial, we will examine the HTTP status codes about their category, type, meaning, standard definition, etc.

HTTP Protocol

Before starting discussing the HTTP status codes we will talk about the HTTP protocol. HTTP word as client-server architecture where the requestion part is named as the client and responding part will be named as the server. HTTP is a stateless protocol which means every request is separate from others. Requests fo not related to other requests.

HTTP Status Codes

As stated previous every HTTP request will be responded with an HTTP status code which will provide information about the request in a formal manner. HTTP status codes are standard and provide generic responses about the request.

When we send a GET request to the www.poftut.com we will get a HTTP 200 status code which means the request is fulfilled and response is returned like below.

In the following example, we send a GET request to the www.poftut.com/aaa as there is no resource like that the HTTP response code is 404 which means Not Found.

HTTP Status Code Compatibility with Browsers

HTTP is an old and standardized protocol where all of the modern and popular browsers support. Also, all HTTP status codes are supported by these browsers like Google Chrome, Mozilla Firefox, Microsoft Edge, Microsoft Internet Explorer, Opera, …

HTTP Status Code Categories/Types

Well, there are a lot of HTTP status codes. So the HTTP status codes are categorized according to their meanings. Also, the status codes are numbered according to their categories. The HTTP status code numbers start from 100 and continue to the 599. Below we will briefly explain these HTTP status categories.

Informational Responses (100-199)

As the category name suggests it is mainly used to provide some information about the process going on. The server uses this category to switch protocol, the current status of the request.

Successful Responses (200-299)

Successful Responses are the most used HTTP status code where after a successful operation on the server side returned to the client. 200 OK status code is the most popular one.

Redirects (300-399)

Redirect category responses mainly used to redirect the given requests. There may be different reasons for a redirect which are provided with the HTTP status code like 305 Use proxy, 307 Temporary Redirect etc.

Client Errors (400-499)

Client Errors are used to provide information about request errors. It can be a bad request, forbidden, method not allowed, etc.

Server Errors(500-599)

Server Errors are related to the request processing where there is an error with the server-side request execution. The server-side errors can be an internal error, bad gateway, gateway timeout, insufficient storage, etc.

HTTP Status Codes

Let’s start examining the HTTP status codes in detail according to their categories.

Informational Responses (100-199)

  • `100 Continue` is used to provide everything that is OK so far and the operation is continuing on the server.
  • `101 Switching Protocol` is used as a response from the client `Upgrade` request header. This will change the protocol version between the client and the server.
  • `102 Processing` is used in WebDAV which simply responds to the client that the WebDAV operation is continuing without a problem on the server.
  • `102 Early Hints` is used to provide the client links to preload before the server response. The links are provided in the HTTP response header part.

Successful Responses (200-299)

  • `200 OK` is the most famous HTTP status code which simply returned from the server to the client that the request is processed without a problem. It can be used with different HTTP methods like GET, HEAD, PUT, POST, and TRACE.
  • `201 Created` is returned when some object is created on the server-side to inform the client.
  • `202 Accepted` is an intermediate response for successful requests to accept where the processes are going on.
  • `203 Non-Authoritative Information`
  • `204 No Content` is used for a successful response without any HTTP content.
  • `205 Reset Content` will tell the user-agent to reset the document which sent this request.
  • `206 Partial Content` is a response code that is used with the `Range` HTTP header to show only some part of the content is received.
  • `207 Multi-Status` is a WebDAV related code that is used to provide there are multiple status codes that exist.
  • `208 Already Reported` is a WebDAV code.
  • `226 IM Used`

Redirects (300-399)

  • `300 Multiple Choice` means the request has more than one possible response.
  • `301 Moved Permanently` informs the client that provide resource or URL is moved permanently to the given URL.
  • `302 Found` means the URI which is changed temporarily is found.
  • `303 See Other` is inform the client that using another URI with GET request.
  • `304 Not Modified` is used for caching purposes to inform requested URI is not changed and can be cached.
  • `305 Use Proxy` informs the client that in order to access this document a proxy should be used.
  • `305 Unused` is an HTTP status code that is not used for a long time.
  • `307 Temporary Redirect` is used temporarily redirect to another URI.

Client Errors (400-499)

  • `400 Bad Request` is another popular response which simply expresses that the client request is invalid.
  • `401 Unauthorized` response is simply express that the client does not authorize to use this document or resource. The client needs to authorize with HTTP digest.
  • `402 Payment Required` is reserved for future use in order to use for payment for the given resource.
  • `403 Forbidden` is used to express that a given resource or document is forbidden for access.
  • `404 Not Found` is another popular response code which is used given URI or URL is not found.
  • `405 Method Not Allowed` returned where the given method is can not be used for the given resource or document.
  • `406 Not Acceptable`
  • `407 Proxy Authentication` is used when there is a need for proxy authentication for access to a source.

Server Errors(500-599)

  • `500 Internal Server Error` is responded to the client where there is an error while fulfilling the request.
  • `502 Not Implemented` is returned where client request is not implemented on the server-side.
  • `502 Bad Gateway` is returned while acting as a gateway or proxy where the target server do not provide any meaningful response.
  • `503 Server Unavailable` is returned where the target service is temporary overload or maintenance.
  • `504 Gateway Timeout` will be returned where the request will take longer than the expected time where the request will be canceled with a timeout.
  • `505 HTTP Version Not Supported` is related to the HTTP version where the client provided HTTP version is not supported by the server.

Leave a Comment