Http Status Codes

March 14, 2023, 9:56 p.m.

programming web development

HTTP, or Hypertext Transfer Protocol, is the protocol used by web browsers and servers to communicate with each other over the internet. Whenever a user makes a request to a web server, the server responds with an HTTP status code, which indicates the success or failure of the request.

Categories

There are five main categories of HTTP status codes, each with their own set of codes:

Informational (1xx)

These codes indicate that the server has received the request, but the process is not yet complete. Examples include 100 (Continue), 101 (Switching Protocols), and 102 (Processing).

Success (2xx)

These codes indicate that the server has successfully received, understood, and processed the request. Examples include 200 (OK), 201 (Created), and 204 (No Content).

Redirection (3xx)

These codes indicate that the requested resource is not available at the current URL, but can be found at a different URL. Examples include 301 (Moved Permanently), 302 (Found), and 304 (Not Modified).

Client Error (4xx)

These codes indicate that the request was malformed or invalid, and could not be processed by the server. Examples include 400 (Bad Request), 401 (Unauthorized), and 404 (Not Found).

Server Error (5xx)

These codes indicate that the server encountered an error while processing the request. Examples include 500 (Internal Server Error), 502 (Bad Gateway), and 503 (Service Unavailable).

Common Status codes

Here is a list of some of the most common HTTP status codes, along with a brief explanation of each:

200 OK

This code indicates that the request was successful and the server is returning the requested resource.

201 Created

This code is used to indicate that a new resource has been created on the server, such as a new user account or blog post.

204 No Content

This code is used to indicate that the request was successful, but there is no content to return.

301 Moved Permanently

This code is used to indicate that the requested resource has been permanently moved to a new URL.

302 Found

This code is similar to 301, but indicates that the move is temporary.

304 Not Modified

This code is used to indicate that the requested resource has not been modified since the last time it was accessed.

400 Bad Request

This code is used to indicate that the request was malformed or invalid, and could not be processed by the server.

401 Unauthorized

This code is used to indicate that the user is not authorized to access the requested resource.

403 Forbidden

This code is used to indicate that the user is authenticated, but does not have permission to access the requested resource.

404 Not Found

This code is used to indicate that the requested resource does not exist on the server.

500 Internal Server Error

This code is used to indicate that the server encountered an error while processing the request.

502 Bad Gateway

This code is used to indicate that the server acting as a gateway or proxy received an invalid response from the upstream server.

503 Service Unavailable

This code is used to indicate that the server is currently unable to handle the request due to a temporary overload or maintenance.

504 Gateway Timeout

This code is used to indicate that the server acting as a gateway or proxy did not receive a timely response from the upstream server.

HTTP status codes are an important tool for web developers and system administrators to understand, as they provide valuable information about the status of a request and can help diagnose problems with a website or server.

author image

bracketcoders

A learing portal for your coding interest.

View Profile