Introduction
HTTP status codes (response codes) are used to indicate whether an HTTP request has been successfully completed. HTTP response types are divided into five major categories: informational responses, successful responses, redirections, client errors, and server errors.
Status Codes
100 Continue
The client should continue sending the request. This interim response is used to inform the client that part of its request has been received by the server and has not yet been rejected. The client should continue sending the remaining part of the request, or, if the request has already been completed, ignore this response. The server must send a final response to the client after the request is completed.
101 Switching Protocol
The server has understood the client's request and will notify the client through the Upgrade message header to adopt a different protocol to complete this request. After sending the final empty line of this response, the server will switch to the protocol(s) defined in the Upgrade message header.: Such measures should only be taken when switching to a new protocol is more beneficial. For example, switching to a new HTTP version has advantages over the old version, or switching to a real-time and synchronous protocol to transmit resources that exploit such characteristics.
200 OK
The request succeeded. The meaning of success varies depending on the method used by the request.
GET: The resource has been extracted and returned to the client as the response body.
HEAD: The entity headers have been returned to the client as response headers.
POST: After the server processes the data sent by the client, a suitable resource is returned to the client as the response body.
TRACE: The server returns the received request message to the client as the response body.
201 Created
The request succeeded, and a new resource has been created according to the needs of the request; this is usually the response code obtained with the PUT method.
202 Accepted
The server has accepted the request but has not yet processed it. Just as it may be rejected, the request may or may not ultimately be executed. In the case of asynchronous operations, there is no more convenient approach than sending this status code.: The purpose of returning a response with the 202 status code is to allow the server to accept requests from other processes (for example, a batch-based operation that is executed only once a day), without requiring the client to keep the connection to the server until the batch operation is fully completed. A response that accepts the request for processing and returns the 202 status code should include in the returned entity some information indicating the current processing state, as well as a pointer to a processing status monitor or status prediction, so that the user can estimate whether the operation has been completed.
203 Non-Authoritative Information
The server has successfully processed the request, but the entity header metadata returned is not a definitive set valid on the origin server; instead, it comes from a local or third-party copy. If this is not the case, using the 200 status code is the most appropriate.
204 No Content
This response has no response content, only response headers, and the response headers may also be useful. The user agent can update the cached information of the corresponding resource based on the new response headers.
205 Reset Content
Tells the user agent to reset the document view of the window that sent the request.
206 Partial Content
This status code is used when the client performs a segmented file download by using the range header field
300 Multiple Choice
The request has multiple possible responses, and the user agent or the user must choose one of them. The server has no criteria to follow to make the choice on behalf of the user.
301 Moved Permanently
This status code indicates that the resource path of the requested URI has changed; the new URL can be found in the Location: header field of the response.
**302 Found **
This status code indicates that the resource path of the requested URI has temporarily changed and may continue to change. Therefore, the client must continue to use this URI in future accesses. The new URL can be found in the Location: header field of the response.
303 See Other
The server sends this response to guide the client to access another URI using the GET method.
304 Not Modified
Tells the client that the requested content has not changed since the last access. The client can obtain the resource directly from the browser cache.
305 Use Proxy
The requested resource can only be accessed through a proxy. For security reasons, this status code is not widely supported.
**306 unused **
This status code is no longer used; it was originally used in older versions of the HTTP 1.1 specification.
307 Temporary Redirect
The server sends this response to guide the client to access another URI using the same method to obtain the desired resource. The new URL can be found in the Location: header field of the response. It has the same semantics as the 302 status code, and the same method (GET POST) must be used for both accesses.
308 Permanent Redirect
The requested resource will permanently reside at another URI. The new URL can be found in the Location: header field of the response. It has the same semantics as the 301 status code, and the same method (GET POST) must be used for both accesses.
400 Bad Request
Because the sent request has a syntax error, the server cannot read it properly.
401 Unauthorized
Authentication is required before the requested content can be obtained, similar to the 403 error. The difference is that after a 401 error, as long as the correct account and password are entered, authentication will pass.
402 Payment Required
This status code is reserved for future use. It was originally created for digital payment systems; however, it has still not been put into use.
403 Forbidden
The client has no right to access the requested content, and the server refuses this request.
404 Not Found
The server cannot find the requested resource. Because this situation occurs frequently, this status code is very common when browsing the web.
405 Method Not Allowed
The method used by the request is prohibited by the server; RFC2616 specifies that the GET and HEAD methods cannot be prohibited.
406 Not Acceptable
After server-driven content negotiation, no suitable content was found to return to the client.
407 Proxy Authentication Required
Similar to status code 401, but authentication can only be performed through a proxy.
408 Request Timeout
The client did not complete sending a request within the time the server was prepared to wait. This means the server will cut off the connection with the client. In other browsers, this response is more common, such as Chrome and IE9, in order to use the HTTP pre-connection mechanism to speed up browsing. Also note that some servers cut off the connection directly without sending this response.
409 Conflict
The request conflicts with the current state of the server.
410 Gone
The requested resource has been deleted.
411 Length Required
Because the server requires the Content-Length header field in this request but the client did not send it, the server rejected the request.
412 Precondition Failed
The server failed to satisfy the preconditions set by the client in the request header fields when obtaining the resource.
413 Request Entity Too Large
The size of the request entity exceeds the maximum limit set by the server; the server may close the HTTP connection and return a Retry-After header field.
414 Request-URI Too Long
The URI included in the client request is too long for the server to process.
415 Unsupported Media Type
The server does not support the media type requested by the client, so it rejects the request.
416 Requested Range Not Satisfiable
The Range header field included in the request cannot be satisfied, usually because the numeric range in the Range exceeds the size of the requested resource.
417 Expectation Failed
The expectation specified in the Expect request header cannot be satisfied by the server.
500 Internal Server Error
The server encountered an unknown problem that it cannot resolve.
501 Implemented
The server does not support the method used in the request, such as POST and PUT. Only GET and HEAD are methods that RFC2616 specifies servers must implement.
502 Bad Gateway
The server, acting as a gateway, obtained an invalid HTTP response from an upstream server.
503 Service Unavailable
Due to temporary server maintenance or overload, the server is currently unable to process the request. This condition is temporary and will recover after a period of time. If the delay time can be estimated, the response can include a Retry-After: header to indicate this delay time. If this Retry-After: information is not given, the client should handle it in the same way as a 500 response. In addition, in this case, a friendly page explaining that the server has a problem should be returned, and cache-related HTTP header information should also be included, because usually such error pages should not be cached by the client.
504 Gateway Timeout
The server, acting as a gateway, cannot obtain a timely response from the upstream server to return to the client.
505 HTTP Version Not Supported
The server does not support the HTTP protocol version used in the HTTP request sent by the client.