HTTP Status Codes:
The Internet Assigned Numbers Authority (IANA) is the organization which is responsible for maintaining the registry of HTTP response codes. IANA defines the codes and ensures they are used consistently across the internet.
HTTP status codes are standard response codes that provide information about the status of a request made to a web server. These codes indicate the success or failure of a requested HTTP operation. HTTP defines request methods to indicate the desired action for a resource. Here are the 9 important request methods:
GET retrieves data from a specified resource.
HEAD retrieves data from a specified resource without returning the body of the response.
POST sends data to a server to create a new resource.
PUT updates an existing resource with new data.
DELETE removes a specified resource.
OPTIONS retrieves the HTTP methods that the server supports.
TRACE traces the request message across the network path to the server.
PATCH applies partial modifications to a resource.
CONNECT establishes a tunnel connection to a server.
We have 3-digit code series of status codes as shown below. Also please check all the status codes for each series explained below.
1XX Series Status Codes:
100 Continue: Server has received the initial part of request, and will send a final response once it processes the full content.
101 Switching Protocols: Server understands the request to change application protocol and will comply if advantageous.
102 Processing: Server has received a full request and is processing it, no response yet as it has not completed.
103 Early Hints: Used with Link header to allow browser to preload resources while server is preparing a response.
2XX Series Status Codes:
200 OK: Request has succeeded, meaning depends on the request method (GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE).
201 Created: Server has completed request, creating one or more new resources identified by Location header or target URI.
202 Accepted: Server has accepted request for processing but is not finished yet, intended for batch processing.
203 Non-Authoritative Information: Request was successful, but transforming proxy changed information before sending to browser.
204 No Content: Server has completed request but there is no additional content to send in response.
205 Reset Content: Server has fulfilled request and user should reset document view to its original state.
206 Partial Content: Server is responding to request for only part of a resource, response includes Content-Range header indicating range or multipart/byte ranges Content-Type with Content-Range fields for each part.
207 Multi-Status: Conveys status of multiple resources, HTTP entity with multi-status root element, used in success/partial/failure situations.
208 Already Reported: Used inside DAV: propstat response element to prevent repeatedly enumerating internal members of multiple bindings to the same collection.
226 IM Used: Server has fulfilled request for resource, returning it in the body of the message and a representation of the result after applying the request's precondition
3XX Series Status Codes:
300 Multiple Choices: Server has multiple options for the resource that the client can choose from.
301 Moved Permanently: Resource has been permanently moved to new URI, future references should use new URI.
302 Found: Resource has been temporarily moved to new URI, future references should use original URI.
303 See Other: Response to request can be found at another URI, new URI is not a substitute reference for original one.
304 Not Modified: Resource has not been modified since last requested, can use cached copy of resource.
305 Use Proxy: Must use a proxy to access the resource, location of the proxy is provided in the response.
306 Unused: No longer used, originally used to switch proxy
307 Temporary Redirect: Resource has been temporarily moved to new URI, future references should use original URI.
308 Permanent Redirect: Resource has been permanently moved to new URI, future references should use new URI.
4XX Series Status Codes:
400 Bad Request: Request could not be understood by server due to malformed syntax.
401 Unauthorized: Requires user authentication to access resources.
402 Payment Required: Reserved for future use, not currently used.
403 Forbidden: Server understands request but refuses to authorize it.
404 Not Found: Requested resource could not be found on server.
405 Method Not Allowed: Request method not supported by resource.
406 Not Acceptable: Resource is only capable of generating responses that are not acceptable according to Accept headers.
407 Proxy Authentication Required: Client must authenticate itself with the proxy to access resources.
408 Request Timeout: Server did not receive complete request in time to process it.
409 Conflict: Request could not be completed due to a conflict with the current state of resource.
410 Gone: Resource is no longer available and it is likely permanent.
411 Length Required: Request did not specify the length of its content, which is required by the resource.
412 Precondition Failed: Server does not meet one of the preconditions that the requester put on the request.
413 Payload Too Large: Request is larger than the server is able to process.
414 URI Too Long: Request URI is too long for the server to process.
415 Unsupported Media Type: Request body is in a format that the server does not support.
416 Range Not Satisfiable: Server cannot provide the portion of the resource requested in the Range header.
417 Expectation Failed: Server cannot meet the requirements of the Expect request header.
418 I'm a teapot: HTTP Extension Framework extension code, used to indicate that the server is a teapot and cannot brew coffee (for example).
421 Misdirected Request: Request was directed at a server that is not able to produce a response.
422 Unprocessable Entity: Request was well-formed, but semantic errors prevent it from being processed.
423 Locked: Resource that the request is attempting to modify is locked.
424 Failed Dependency: Request failed due to failure of a previous request (e.g. a PROPPATCH).
425 Too Early: Server is unwilling to risk processing a request that might be replayed.
426 Upgrade Required: Client should switch to a different protocol (such as TLS/1.0).
428 Precondition Required: Server requires the request to be conditional.
429 Too Many Requests: Client has sent too many requests in a given amount of time.
431 Request Header Fields Too Large: Server is unwilling to process the request because its header fields are too large.
451 Unavailable For Legal Reasons: Client requests a resource that has been removed due to legal reasons, such as a blocked site or page.
499 Client Closed Request: Occurs when a client terminates the connection before the server is able to respond, such as when a user cancels a request or navigates away from a page before it fully loads.
5XX Series Status Codes:
500 Internal Server Error: Server encountered an unexpected condition that prevented it from fulfilling the request.
501 Not Implemented: Server does not support the functionality required to fulfill the request.
502 Bad Gateway: Server received an invalid response from an upstream server while attempting to fulfill the request.
503 Service Unavailable: Server is currently unable to handle the request due to a temporary overload or maintenance.
504 Gateway Timeout: Server did not receive a timely response from an upstream server while attempting to fulfill the request.
505 HTTP Version Not Supported: Server does not support the HTTP protocol version used in the request.
506 Variant Also Negotiates: Server has an internal configuration error: transparent content negotiation for the request results in a circular reference.
507 Insufficient Storage: Server is unable to store the representation needed to complete the request.
508 Loop Detected: Server detected an infinite loop while processing the request (WebDAV).
510 Not Extended: Further extensions to the request are required for the server to fulfill it (RFC 2774).
511 Network Authentication Required: Client needs to authenticate to access the network.
599 Network Connect Timeout Error: Occurs when the server encounters an unexpected error or crash. For example, server overload.
Summary:
HTTP Status codes are very informative. Even though they seem intimidating, if we learn common ones, it will be easy to troubleshoot problems on the site more quickly. In this blog, we have defined 50+ HTTP status codes that you may encounter while working. From the middle 100, 200, 300 level codes to the tricker 400, 500 level errors, making sense of these messages is crucial for maintaining a website and making sure it is accessible to users.
Resources:
Very useful.