HTTP Status Codes
When a visitor accesses a webpage, the visitor's browser sends a request to the server hosting the webpage. Before the browser receives and displays the webpage, the server hosting the webpage returns an information header (server header) containing the HTTP status code to respond to the browser's request.
The English term for HTTP status code isHTTP Status Code。
The following are common HTTP status codes:
- 1xx (Informational status codes): Indicates that the received request is being processed.
- 2xx (Successful status codes): Indicates that the request was processed normally.
- 3xx (Redirection status codes): Further operations are required to complete this request.
- 4xx (Client error status codes): Indicates that the request contains a syntax error or cannot be completed.
- 5xx (Server error status codes): Indicates that the server encountered an error while processing the request.
HTTP Status Code Classification
HTTP status codes consist of three decimal digits, and the first decimal digit defines the type of status code. Responses are divided into five categories: informational responses (100–199), successful responses (200–299), redirections (300–399), client errors (400–499), and server errors (500–599):
| Category | Category Description |
|---|---|
| 1** | Informational — The server has received the request and requires the requester to continue performing the operation. |
| 2** | Successful — The operation was successfully received and processed. |
| 3** | Redirection — Further operations are needed to complete the request. |
| 4** | Client error — The request contains a syntax error or cannot be completed. |
| 5** | Server error — The server encountered an error while processing the request. |
HTTP status code list:
| Status Code | Status Code English Name | Chinese Description |
|---|---|---|
| 100 | Continue | Continue. The client should continue with its request. |
| 101 | Switching Protocols | Switching Protocols. The server switches protocols according to the client's request. It can only switch to a higher-level protocol, for example, switching to a new version of the HTTP protocol. |
| 200 | OK | Request successful. Generally used for GET and POST requests. |
| 201 | Created | Created. The request succeeded and a new resource was created. |
| 202 | Accepted | Accepted. The request has been accepted, but processing has not been completed. |
| 203 | Non-Authoritative Information | Non-Authoritative Information. The request succeeded. However, the returned meta information is not from the original server but from a copy. |
| 204 | No Content | No Content. The server successfully processed the request, but returned no content. Without updating the webpage, this ensures the browser continues to display the current document. |
| 205 | Reset Content | Reset Content. The server processed successfully, and the user terminal (e.g., browser) should reset the document view. This return code can be used to clear the browser's form fields. |
| 206 | Partial Content | Partial Content. The server successfully processed a partial GET request. |
| 300 | Multiple Choices | Multiple Choices. The requested resource may be available at multiple locations. A list of resource characteristics and addresses can be returned for the user terminal (e.g., browser) to choose from. |
| 301 | Moved Permanently | Moved Permanently. The requested resource has been permanently moved to a new URI. The returned information includes the new URI, and the browser will automatically redirect to the new URI. Any new requests in the future should use the new URI instead. |
| 302 | Found | Temporarily Moved. Similar to 301. But the resource is only temporarily moved. The client should continue to use the original URI. |
| 303 | See Other | See Other. Similar to 301. Use GET and POST requests to view. |
| 304 | Not Modified | Not Modified. The requested resource has not been modified. When the server returns this status code, it will not return any resources. Clients typically cache accessed resources and provide a header indicating that the client wants only resources modified after a specified date to be returned. |
| 305 | Use Proxy | Use Proxy. The requested resource must be accessed through a proxy. |
| 306 | Unused | Deprecated HTTP status code |
| 307 | Temporary Redirect | Temporary Redirect. Similar to 302. Redirect using a GET request. |
| 400 | Bad Request | The client request has a syntax error that the server cannot understand. |
| 401 | Unauthorized | The request requires user authentication. |
| 402 | Payment Required | Reserved for future use. |
| 403 | Forbidden | The server understands the client's request but refuses to execute it. |
| 404 | Not Found | The server cannot find the resource (webpage) based on the client's request. With this code, website designers can set up a custom page saying "The resource you requested cannot be found". |
| 405 | Method Not Allowed | The method in the client's request is forbidden. |
| 406 | Not Acceptable | The server cannot complete the request based on the content characteristics of the client's request. |
| 407 | Proxy Authentication Required | The request requires proxy authentication. Similar to 401, but the requester should use a proxy for authorization. |
| 408 | Request Time-out | The server waited too long for the client to send a request and timed out. |
| 409 | Conflict | The server may return this code when completing the client's PUT request. A conflict occurred while the server was processing the request. |
| 410 | Gone | The resource requested by the client no longer exists. 410 is different from 404. If a resource existed before but has been permanently deleted, the 410 code can be used. Website designers can use the 301 code to specify the new location of the resource. |
| 411 | Length Required | The server cannot process the request information sent by the client without Content-Length. |
| 412 | Precondition Failed | The preconditions in the client's request information are incorrect. |
| 413 | Request Entity Too Large | Because the request entity is too large, the server cannot process it and therefore rejects the request. To prevent continuous requests from the client, the server may close the connection. If the server is only temporarily unable to process it, a Retry-After response header will be included. |
| 414 | Request-URI Too Large | The requested URI is too long (a URI is usually a URL), and the server cannot process it. |
| 415 | Unsupported Media Type | The server cannot process the media format accompanying the request. |
| 416 | Requested range not satisfiable | The range requested by the client is invalid. |
| 417 | Expectation Failed (expected failure) | The server cannot satisfy the expected behavior specified by the Expect field in the request header. |
| 418 | I'm a teapot | Status code 418 is actually an April Fools' Day joke. It is defined in RFC 2324, which is a joke document about the Hyper Text Coffee Pot Control Protocol (HTCPCP). In this joke, the 418 status code was added to the HTTP protocol as a joke. |
| 500 | Internal Server Error | Internal server error, unable to complete the request. |
| 501 | Not Implemented | The server does not support the functionality requested and cannot complete the request. |
| 502 | Bad Gateway | When a server acting as a gateway or proxy attempts to execute a request, it received an invalid response from a remote server. |
| 503 | Service Unavailable | Due to overload or system maintenance, the server is temporarily unable to process the client's request. The length of the delay can be included in the server's Retry-After header information. |
| 504 | Gateway Time-out | The server acting as a gateway or proxy did not obtain the request from the upstream server in time. |
| 505 | HTTP Version not supported | The server does not support the version of the HTTP protocol used in the request and cannot complete processing. |