Complete List of HTTP Protocol Status Codes

Faraz Logo

By Faraz -

Discover the complete list of HTTP status codes and their meanings. Learn how to handle errors and optimize web development with this comprehensive guide.


Complete List of HTTP Protocol Status Codes.webp

HTTP (Hypertext Transfer Protocol) status codes are essential indicators that convey information about the result of a client's request to a server. Understanding these status codes is crucial for web developers, server administrators, and anyone involved in web operations. This comprehensive guide aims to provide a complete list of HTTP status codes, categorized according to their significance and purpose.

Table of Contents

  1. Introduction to HTTP Protocol Status Codes
  2. 1xx - Informational
  3. 2xx - Successful
  4. 3xx - Redirection
  5. 4xx - Client Error
  6. 5xx - Server Error
  7. Best Practices for Handling HTTP Status Codes
  8. Conclusion
  9. Frequently Asked Questions (FAQs)

Introduction to HTTP Protocol Status Codes

What is HTTP Protocol?

HTTP (Hypertext Transfer Protocol) is a set of rules that allows the transfer of data on the Internet. It defines how messages are formatted and transmitted, as well as how web servers and browsers should respond to various commands.

What are Status Codes?

HTTP status codes are three-digit numbers that indicate the status of a request made by a client to a server. These codes are grouped into five categories, each representing a different type of response.

1xx - Informational

Informational status codes, denoted by the 1xx series, signify provisional responses. These codes are used to inform the client that the server has received the request and is continuing with the process.

  • 100 Continue: The server has received the request headers and the client should proceed with sending the request body.
  • 101 Switching Protocols: The server is acknowledging the client's upgrade request to switch protocols.
  • 102 Processing: The server has received and is processing the request, but no response is available yet.
  • 103 Early Hints: Indicates that the server is sending some response headers before the final response.

2xx - Successful

Successful status codes, represented by the 2xx series, indicate that the request was received, understood, and accepted successfully. These codes signify that the client's request was processed without any issues. A prime example is 200 OK, which indicates that the request was successful and the server is returning the requested data.

  • 200 OK: The request was successful.
  • 201 Created: The request has been fulfilled, resulting in the creation of a new resource.
  • 202 Accepted: The request has been accepted for processing, but the processing is not yet complete.
  • 203 Non-Authoritative Information: The server is a transforming proxy and received a 200 OK from the origin server, but is returning a modified version of the response.
  • 204 No Content: The server successfully processed the request but is not returning any content.
  • 205 Reset Content: Instruct the client to reset the document from which the original request was sent.
  • 206 Partial Content: The server is delivering only part of the resource due to a range header sent by the client.
  • 207 Multi-Status: Status for multiple independent operations.
  • 208 Already Reported: The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response, and are not being included again.
  • 226 IM Used: The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.

3xx - Redirection

Redirection status codes, denoted by the 3xx series, inform the client that further action needs to be taken to complete the request. These codes are often used when a resource has been moved to a different location permanently or temporarily. For instance, 301 Moved Permanently indicates that the requested resource has been permanently moved to a new URL.

  • 300 Multiple Choices: Indicates multiple options for the resource from which the client may choose.
  • 301 Moved Permanently: The resource requested has been permanently moved to a new location.
  • 302 Found: The requested resource resides temporarily under a different URI.
  • 303 See Other: Indicates that the response to the request can be found under a different URI.
  • 304 Not Modified: Indicates that the resource has not been modified since the version specified by the request headers.
  • 305 Use Proxy: The requested resource must be accessed through the proxy given by the Location field.
  • 306 Switch Proxy: No longer used.
  • 307 Temporary Redirect: The requested resource resides temporarily under a different URI.
  • 308 Permanent Redirect: The target resource has been assigned a new permanent URI and any future references to this resource should use one of the enclosed URIs.

4xx - Client Error

Client error status codes, represented by the 4xx series, indicate that the client's request cannot be fulfilled due to errors on the client's part. These errors are typically caused by malformed requests, authentication issues, or missing resources. A common example is 404 Not Found, which indicates that the requested resource could not be found on the server.

  • 400 Bad Request: The server cannot process the request due to a client error, such as malformed syntax.
  • 401 Unauthorized: The request requires user authentication. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
  • 402 Payment Required: Reserved for future use.
  • 403 Forbidden: The server understood the request but refused to authorize it.
  • 404 Not Found: The server cannot find the requested resource.
  • 405 Method Not Allowed: The method specified in the request is not allowed for the resource identified by the request URI.
  • 406 Not Acceptable: The server cannot generate a response that the client would accept.
  • 407 Proxy Authentication Required: Similar to 401 Unauthorized, but for proxy servers.
  • 408 Request Timeout: The server timed out waiting for the request.
  • 409 Conflict: Indicates that the request could not be completed due to a conflict with the current state of the resource.
  • 410 Gone: The requested resource is no longer available at the server and no forwarding address is known.
  • 411 Length Required: The server refuses to accept the request without a defined Content-Length.
  • 412 Precondition Failed: One or more conditions set in the request header fields evaluated to false when tested on the server.
  • 413 Payload Too Large: The server refuses to process the request because the request payload is larger than the server is willing or able to process.
  • 414 URI Too Long: The server refuses to process the request because the URI is longer than the server is willing to interpret.
  • 415 Unsupported Media Type: The server refuses to accept the request because the payload format is in an unsupported format.
  • 416 Range Not Satisfiable: The client has asked for a portion of the file but the server cannot supply that portion.
  • 417 Expectation Failed: The server cannot meet the requirements of the Expect request-header field.
  • 418 I'm a teapot: This code was defined in 1998 as one of the traditional IETF April Fools' jokes, as specified in RFC 2324. It is not expected to be implemented by actual HTTP servers.
  • 421 Misdirected Request: The request was directed at a server that is not able to produce a response.
  • 422 Unprocessable Entity: The server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.
  • 423 Locked: The resource that is being accessed is locked.
  • 424 Failed Dependency: The request failed because it depended on another request and that request failed.
  • 425 Too Early: Indicates that the server is unwilling to risk processing a request that might be replayed.
  • 426 Upgrade Required: The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
  • 428 Precondition Required: The origin server requires the request to be conditional.
  • 429 Too Many Requests: The user has sent too many requests in a given amount of time.
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large.
  • 451 Unavailable For Legal Reasons: The server is denying access to the resource as a consequence of a legal demand.
  • 499 Client Closed Request: The status code "499" is an unofficial status code commonly used by Nginx web servers. It indicates that the client closed the connection before the server could respond to the request.

5xx - Server Error

Server error status codes, denoted by the 5xx series, indicate that the server failed to fulfill a valid request due to an error on the server side. These errors are often caused by issues such as server overload, misconfiguration, or unavailability of server resources. An example is 500 Internal Server Error, indicating a generic error message when no more specific message is suitable.

  • 500 Internal Server Error: A generic error message indicating that the server encountered an unexpected condition that prevented it from fulfilling the request.
  • 501 Not Implemented: The server does not support the functionality required to fulfill the request.
  • 502 Bad Gateway: The server received an invalid response from an upstream server while attempting to fulfill the request.
  • 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance of the server.
  • 504 Gateway Timeout: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI or some other auxiliary server it needed to access to complete the request.
  • 505 HTTP Version Not Supported: The server does not support or refuses to support, the major version of HTTP that was used in the request message.
  • 506 Variant Also Negotiates: Transparent content negotiation for the request results in a circular reference.
  • 507 Insufficient Storage: The server is unable to store the representation needed to complete the request.
  • 508 Loop Detected: The server detected an infinite loop while processing the request.
  • 510 Not Extended: Further extensions to the request are required for the server to fulfill it.
  • 511 Network Authentication Required: The client needs to authenticate to gain network access. Used by captive portals to redirect clients to a login page.
  • 599 Network Connect Timeout Error: The status code "599 Network Connect Timeout Error" is not a standard HTTP status code defined by the Internet Engineering Task Force (IETF). It appears to be a custom code used by some web servers or proxies to indicate a network connection timeout error.

Best Practices for Handling HTTP Status Codes

Handling HTTP status codes effectively is crucial for ensuring a smooth user experience and troubleshooting issues promptly. Here are some best practices for handling status codes:

  1. Understand the Meaning: Familiarize yourself with the meaning and implications of different HTTP status codes.
  2. Handle Errors Gracefully: Implement error handling mechanisms to gracefully manage errors and provide informative messages to users.
  3. Monitor Status Codes: Regularly monitor HTTP status codes on your website or web application to identify and address any issues promptly.
  4. Custom Error Pages: Create custom error pages to provide users with helpful information when they encounter errors.
  5. Use Redirects Wisely: Use redirection (3xx) status codes judiciously to ensure an optimal user experience.

Conclusion

In conclusion, HTTP protocol status codes serve as a crucial aspect of web communication, providing valuable insights into the outcome of HTTP requests. Whether it's indicating success, redirection, or errors, these codes facilitate efficient communication between clients and servers. Understanding these codes is essential for web developers to diagnose and troubleshoot issues effectively, ensuring seamless user experiences.

Frequently Asked Questions (FAQs)

Q1. What are HTTP protocol status codes?

HTTP protocol status codes are standardized three-digit numbers used to indicate the outcome of HTTP requests made by a client to a server.

Q2. Why are HTTP status codes important?

HTTP status codes provide valuable information about the success, failure, or redirection of requests, helping both developers and users understand the status of their interactions with web servers.

Q3. How are HTTP status codes categorized?

HTTP status codes are categorized into five classes: Informational (1xx), Successful (2xx), Redirection (3xx), Client Error (4xx), and Server Error (5xx).

Q4. Can HTTP status codes be customized?

While the standard HTTP status codes are predefined, developers can create custom status codes for specific applications or scenarios to provide more context to clients.

Q5. What is the most common HTTP status code?

The most common HTTP status code is 200, which indicates a successful request.

Q6. What should I do if I encounter a server error status code?

If you encounter a server error status code (5xx), it typically indicates an issue with the server. In such cases, you can try reloading the page, checking your internet connection, or contacting the website administrator for assistance.

Q7. What does a 404 HTTP status code mean?

A 404 status code indicates that the requested resource was not found on the server, commonly known as a "Not Found" error.

Q8. How can I handle a 500 Internal Server Error?

To handle a 500 error, investigate the server logs to identify the root cause of the issue and implement appropriate fixes.

That’s a wrap!

Thank you for taking the time to read this article! I hope you found it informative and enjoyable. If you did, please consider sharing it with your friends and followers. Your support helps me continue creating content like this.

Stay updated with our latest content by signing up for our email newsletter! Be the first to know about new articles and exciting updates directly in your inbox. Don't miss out—subscribe today!

If you'd like to support my work directly, you can buy me a coffee . Your generosity is greatly appreciated and helps me keep bringing you high-quality articles.

Thanks!
Faraz 😊

End of the article

Subscribe to my Newsletter

Get the latest posts delivered right to your inbox


Latest Post