HTTP Status Codes

HTTP Status Codes

HTTP status codes are three-digit numbers returned by a server to indicate the status of a requested operation or to provide information about the server's response. These codes are a part of the HTTP (Hypertext Transfer Protocol) standard and are included in the response message header sent by the server to the client's browser.

HTTP status codes are grouped into several classes, each representing a different category of response. The first digit of the status code defines the class of response, while the last two digits do not have any categorization role.

Here are some common HTTP status code classes:

  1. 1xx (Informational): Request received, continuing process.

    • 100 - Continue

    • 101 - Switching

    • 102 - Processing

    • 103 - Early Hints

  2. 2xx (Success): The request was successfully received, understood, and accepted.

    • 200 - Ok

    • 201 - Created

    • 202 - Accepted

    • 204 - No Content

  3. 3xx (Redirection): Further action needs to be taken to complete the request.

    • 301 - Moved Permanently

    • 302 - Found

    • 303 - See Other

    • 307 - Temporary Redirect

  4. 4xx (Client Error): The request contains bad syntax or cannot be fulfilled by the server.

    • 400 - Bad Request

    • 401 - Unauthorized

    • 403 - Forbidden

    • 404 Not Found

  5. 5xx (Server Error): The server failed to fulfill a valid request.

    • 500 - Internal Server Error

    • 502 - Bad Gateway

    • 503 - Service Unavailable

    • 504 - Gateway Timeout

HTTP status codes are crucial for understanding the outcome of an HTTP request and diagnosing issues when interacting with web servers. Developers and system administrators often use these codes to identify and troubleshoot problems in web applications.