HTTP status codes

Written by Kuligaposten

HTTP status codes

HTTP Status Codes Every Developer Should Know

HTTP status codes are three-digit numbers returned by a server to indicate the status of a client’s request. Understanding these codes is crucial for web developers as they provide insights into the outcome of an HTTP request. Here’s a concise guide to some of the essential HTTP status codes:

1xx - Informational:

  • 100 Continue: The server acknowledges the initial part of the request and awaits the client’s further instructions.

2xx - Success:

  • 200 OK: The request was successful, and the server responds with the requested data.
  • 201 Created: A new resource was successfully created as a result of the request.
  • 204 No Content: The server successfully processed the request, but there is no content to send in the response.

3xx - Redirection:

  • 301 Moved Permanently: The requested resource has been permanently moved to a new location.
  • 302 Found (or 303 See Other): The requested resource resides temporarily under a different URI.
  • 304 Not Modified: The resource has not been modified since the last request, and the client should use its cached copy.

4xx - Client Errors:

  • 400 Bad Request: The server cannot process the request due to a client error.
  • 401 Unauthorized: Authentication is required, and the provided credentials are not valid.
  • 403 Forbidden: The server understood the request, but the server refuses to authorize it.
  • 404 Not Found: The requested resource could not be found on the server.

5xx - Server Errors:

  • 500 Internal Server Error: A generic error message indicating an unexpected condition that prevented the server from fulfilling the request.
  • 501 Not Implemented: The server does not support the functionality required to fulfill the request.
  • 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server.

503 Service Unavailable:

The server is not ready to handle the request. Common causes include maintenance or temporary overloading of the server.

Additional Status Codes:

  • 429 Too Many Requests: The user has sent too many requests in a given amount of time.
  • 451 Unavailable For Legal Reasons: The server is denying access to the resource as a consequence of a legal demand.

Conclusion:

HTTP status codes are invaluable tools for developers, providing immediate feedback on the outcome of a request. They aid in debugging, troubleshooting, and enhancing the overall user experience. Familiarity with these codes is essential for effective web development, ensuring that developers can interpret and respond appropriately to the feedback provided by the server.

Go back