HTTP response codes are the set of responses sent by the server to a client to inform the request was successfully received and the result of the execution(whether success or error) is represented using the HTTP response codes provided.
Example – status code 200, means the request is successful and OK, whereas status code 400 means there is an error in the request from the client-side, etc.
HTTP response codes are primarily divided into five classes/groups:
It means the request is received and understood. It is issued temporarily while the request is being processed. It tells the user to wait for the final response.
It tells a client that its request was successfully received, understood and accepted by the server.
This class of status code tells the client further action must be taken to complete the request. Most of the times these status codes are used in URL redirection.
4xx: Client Error
This class of status code indicates that the error is made from the client-side. It is issued when the request contains bad syntax or cannot be fulfilled.
5xx: Server Error
This class of status codes are issued the request is valid but the server is unable to process the request. It indicates that the problem is from the server’s end.
Let’s talk about important HTTP response status codes in each category
1) 1xx: Informational
- 100 Continue – It is a temporary response indicating the request, has successfully received by the server and the client should continue the request. It is used for sending a large request body to a server
- 101 Switching Protocol – This means the requester has asked the server to switch protocols and the server has agreed.
- 102 Processing – This indicates the server has received the request and is processing it.
2) 2xx: Success
- 200 OK – This is a standard response for successful HTTP requests.
- 201 Created – The request was successfully processed and a new resource is created.
- 202 Accepted – The request has been accepted, but not fully processed yet.
- 203 Non-Authoritative Information – It means the request is received from a third party application and the original server has accepted the request and returned OK to the third party application.
- 204 No Content – The server has successfully processed the request and is not going to return any content for the request. It is used when the responses header is useful.
- 205 Reset Content – This tells the user-agent that the server has successfully received the request(and the server will not send any content) and the user-agent should reset the document which sent this request.
- 206 Partial Content – This tells the server is only sending a part of the actual resource meeting the range specified in the header by the client.
3) 3xx: Redirection
- 300 Multiple Choices – It represents multiple resource options for user-agent(client) to choose from. For example, it can be used to present multiple video format options, and the client can choose anyone.
- 301 Moved Permanently – The requested resource has moved to a different location. The response is the new location where the resource is moved.
- 302 Found – It represents the resource of the request that has been changed temporarily to a different location, but the future request should be made to the current location only.
- 303 See Other – This response tells the client to get the resource form a different location using the GET request method.
- 304 Not Modified – It tells a client that the resource has not been modified and there is no need to request again. When a client stores something in a cache, it also keeps the Last-Modified header. When a request is made for the same file again, the If-Modified-Since header is sent to the server. If this value and the server’s ETag value for that file are both the same, the server sends back the 304 Not Modified HTTP status.
- 305 Use Proxy – (Deprecated) The requested resource can only be accessed using the proxy, the address of which is provided in the response.
- 307 Temporary Redirect – It means the requested resource is temporarily moved to a different location, but the requester should continue to use the original location for future requests. In contrast to 302, in 307 the request method should not change. For instance, a POST request must be repeated using another POST request.
- 308 Permanent Redirect – This means that the resource is permanently moved to a different location(URI), specified by the Location: HTTP Response header and all the future requests should be made to the new URI. It also doesn’t allow the HTTP request method to change while requesting the new URI.
4) 4xx Client Error
- 400 Bad Request – The request has invalid syntax and the server cannot process it.
- 401 Unauthorized – The resource requires authentication and the client has failed to do so.
- 402 Payment Required – Reserved for future use.
- 403 Forbidden – The client doesn’t have a right to access the requested resource/page.
- 404 Not Found – The requested resource/page doesn’t exist, but perhaps available in the future
- 405 Method Not Allowed – The HTTP request method is not supported for the requested resource. For example, a GET request on a form that requires data to be presented via POST.
- 406 Not Acceptable – This status is generated when the content generated by the server cannot be accepted by the client.
- 407 Proxy Authentication Required – The client needs to authenticate itself with a proxy.
- 408 Request Timeout – The client did not send any response in a given connection time window and the server timed out waiting for the request.
- 409 Conflict – Indicates that the request could not be processed because there is a conflict in the current state of the resource
- 410 Gone – The requested resource has been permanently deleted from the server with no forwarding address. After receiving 410 status, the client should not request the resource in the future
- 411 Length Required – The server will not accept this request, because the content length is not defined.
- 412 Precondition Failed – The server didn’t meet a precondition mentioned by the client in its header.
- 413 Payload Too Large – The server cannot process the request, because it is larger than what the server can process.
- 414 URI Too Long – The requested URI(generally URL) is larger than what a server is willing to process. It’s is commonly generated when too much data is encoded in a GET request.
- 415 Unsupported Media Type – The server cannot process the request because the media type encoded in the request is not supported by the server.
- 425 Too Early – The server is unwilling to risk processing a request that might be replayed.
- 426 Upgrade Required – The server cannot process the request with the current protocol and the client should switch to the different protocols given in the Upgrade header field.
- 429 Too Many Request – The client sent too many requests in a given time interval. It is generally used to control the rate of requests sent or received.
5) 5xx Server Error
- 500 Internal Server Error – A generic error message, used when the server encountered an unexpected condition and no more specific message is suitable.
- 501 Not Implemented – The server cannot either handle the request method or it doesn’t recognize the request method.
- 502 Bad Gateway – It means the server while acting as a gateway or proxy, received an invalid response from the upstream server
- 503 Service Unavailable – It means currently the server is not ready to handle the request, because either it is overloaded or down for maintenance. Generally, it is a temporary state.
- 504 Gateway Timeout – This means the server is acting as a gateway and cannot get a response in time from the upstream server.
- 505 HTTP Version Not Supported – The server doesn’t support the HTTP version used in the request.
- 507 Insufficient Storage – The server cannot process a request, because it is unable to store the representation needed to complete the request.
- 508 Loop Detected – The server detected an infinite loop while processing the request.
Did, we miss something or do you want to add some other key points?🤔
Please comment. 😊