Summary of HTTP Status Codes :
HTTP (Hypertext Transfer Protocol) is the protocol used for communication between web servers and clients (such as web browsers). HTTP response codes are three-digit status codes that indicate the outcome of an HTTP request. Here are the main HTTP response code ranges and their details:
1xx Informational:
These codes indicate that the server has received the request and is continuing to process it.
- 100 Continue: This code is sent in response to a request that includes an "Expect" header, which indicates that the client is expecting a specific behavior from the server. The server sends a "100 Continue" response to indicate that it has received the request headers and is ready to receive the request body.
- 101 Switching Protocols: This code is sent in response to a request that includes an "Upgrade" header, which indicates that the client wants to switch to a different protocol. The server sends a "101 Switching Protocols" response to indicate that it has agreed to the protocol switch.
2xx Success:
These codes indicate that the server successfully processed the request.
200 OK: This code indicates that the request was successful, and the server has returned the requested data. This is the most common response code for successful requests.
201 Created: This code indicates that the request was successful, and the server has created a new resource. It is typically used in RESTful APIs when a new resource is created.
202 Accepted: This code indicates that the request was successful, but the server has not yet completed the request. It is typically used for long-running requests that will be processed asynchronously.
204 No Content: This code indicates that the request was successful, but there is no data to return. It is typically used for requests that modify data on the server, such as a POST request to update a resource.
3xx Redirection:
These codes indicate that the client needs to take additional action to complete the request.
301 Moved Permanently: This code indicates that the requested resource has permanently moved to a new URL. The client should update their bookmarks or links to point to the new URL.
302 Found: This code indicates that the requested resource has temporarily moved to a new URL. The client should continue to use the original URL, but the server may redirect them to the new URL.
304 Not Modified: This code indicates that the requested resource has not changed since the last request. The server can use this code to instruct the client to use their cached copy of the resource instead of fetching it again.
4xx Client Error:
These codes indicate that there was an error in the request made by the client.
400 Bad Request: This code indicates that the request was invalid or could not be understood by the server. This can occur if the client provides invalid data or if the request is missing required parameters.
401 Unauthorized: This code indicates that the client needs to provide authentication credentials to access the requested resource. This can occur if the client is not logged in or if their session has expired.
403 Forbidden: This code indicates that the client does not have permission to access the requested resource. This can occur if the client tries to access a resource they do not have permission to access.
404 Not Found: This code indicates that the requested resource could not be found on the server. This can occur if the URL is incorrect or if the resource has been deleted.
5xx Server Error:
These codes indicate that there was an error on the server while processing the request.
500 Internal Server Error: This code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
502 Bad Gateway: This code is sent by a proxy server that is acting as an intermediary between the client and the server. It indicates that the proxy server received an invalid response from an upstream server (e.g., the server it was trying to forward the request to).
503 Service Unavailable: This code indicates that the server is currently unable to handle the request due to a temporary overload or maintenance.
Top comments (0)