HTTP status codes are pretty confusing sometimes. Let's talk about them in a bit more detail.
Informational responses indicate the acceptance and continuation of the requests.
The server tells the client that everything is OK so far keeps sending requests.
The client requests the server to switch the protocol. This response is sent for the Upgrade
HTTP header.
The server hints the client to preload the resources while the server preparing the data to be returned.
As the term suggests, these status codes indicate that the request is successfully received, accepted, and resolved.
This status code indicates the successful HTTP request. It's a standard successful response for GET, POST, PUT, HEAD, and TRACE.
This status code is sent by the server to indicates that a new resource has been created. Generally used for the POST and PUT requests.
Typically used for the async response. The server confirms to the client that the request has been accepted.
The server usually returns this to indicate that server is a proxy that received this data from its origin. The proxy returns the modified version of the origin's data.
The server indicates that all is good but nothing to return.
The server indicates the client to reset the document. Nothing to return as response data.
The server returns this code with the partial data that the client asked for with the Range
HTTP header.
The server usually returns a 3xx redirection status code to indicate that some additional action has to be done by the client to fulfill the request.
The server returns this code when it has multiple options for response.
Server sends the new URL with a 301 status code if the requested URL has been shifted to new URL.
302 indicates that the requested URL has been changed temporarily. Therefore, can't fulfill the request for this moment.
Server tells the client to get the desired resource at another URL with a GET request.
304 Indicates that the resources are the same since the last visit. In this case, the client can use the cached resources.
The server tells the client that you will get the desired resource at another URL with the same request that the client has just made. URL shifting is temporary.
The server tells the client that you will get the desired resource at another URL with the same request that the client has just made. URL shifting is permanent.
The server usually returns 4xx status codes if a client request causes some problem.
Incorrect syntax or invalid URLs are generally the reason for 400 Bad Request.
The server returns 401 to indicate that the client should authenticate itself before making requests.
The client is authenticated but doesn't have permission to access the resource.
We see a 404 response most often. It means that the requested URL is not valid.
The server returns the 405 status code when the request method is valid but not appropriate to get the desired resource.
In simple terms, the server returns a 406 Not Acceptable response when it does not find any suitable response according to the request.
The server returns this code when the client must authenticate itself with the proxy.
The server sends this response without the request, indicating that the server would like to suspend the connection.
The server usually returns this when there is a conflict in the current state of resources.
The resource has been deleted permanently from the server with any redirect URL.
The server indicates that the client must send Content-Length
to get the resource.
The server doesn't meet the precondition that the client mentioned in the request headers.
Request is too large that the server can't handle. In this case, the server might close the connection.
The server returned a 414 code when the URI provided was too long for the server to process.
The server does not support the media type mentioned in the request. For example, the client wants to upload an image as .png, but the server supports the .jpeg media type.
The server returns a 416 code when the range mentioned in the Range
HTTP request header is unsatisfactory. For example, asking for a portion of data that doesn't exist.
The server is not able to provide the relevant data mentioned in the Expect
HTTP header.
The server returns a 422 status when there are semantic errors in the request.
The server indicates that the client should use another protocol to fulfill the request. In response, server sends the required protocol in the Upgrade
header.
The server indicates that the request should be conditional to reduce the chances of conflicts.
The client has sent too many requests in the given time frame. For example, the server only handles 100 requests per second.
Server indicates that the request header is too larger which can't be handled by the server. In this case, the client can reinitiate the request after reducing the sizer of the request header.
The server can't provide the requested resource due to legal reasons.
The 5xx status codes indicate that everything is excellent with the request, but an error occurred on the server-side.
An unexpected situation occurs which server can't handle at this moment.
The server returns 501 when the request is not handled by the server. For example, the client initiates the DELETE request but the server supports only GET and HEAD.
502 status code indicates when the server got the invalid response while acting as the gateway.
Usually, when the server is down for maintenance, the server returns 503 indicating server is not ready to handle the request.
Server cannot get the response from the origin while acting as a gateway.
The server does not support the HTTP protocol version used in the request.
The server returns the 506 Variant Also Negotiates code when there is an internal configuration error.
The server is unable to store the representation needed to complete the request.
The server detected an infinite loop while processing the resource.
The server requires some additional extensions in the request to fulfill it.
The client needs to authenticate to gain network access.