Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTTP Status Codes

HTTP Status Codes

When a visitor accesses a web page, the visitor's browser sends a request to the server hosting the page. Before the browser receives and displays the page, the server returns an information header (server header) containing an HTTP status code in response to the browser's request.

The English term for HTTP status code is HTTP Status Code.

The following are common HTTP status codes:

HTTP Status Code Classes

An HTTP status code consists of three decimal digits, where the first digit defines the type. Responses are divided into five classes: informational responses (100–199), successful responses (200–299), redirections (300–399), client errors (400–499), and server errors (500–599):

Classification Class description
1** Informational: the server received the request and the requester must continue the operation
2** Success: the operation was successfully received and processed
3** Redirection: further action is 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 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, to a newer version of the HTTP protocol.
200 OK OK. The request succeeded. 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 not yet processed.
203 Non-Authoritative Information Non-Authoritative Information. The request succeeded, but the returned meta information is not from the original server but a copy.
204 No Content No Content. The server processed successfully but returned no content. Without updating the web page, it ensures the browser keeps displaying the current document.
205 Reset Content Reset Content. The server processed successfully, and the user agent (e.g., the browser) should reset the document view. This 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 include multiple locations, and a list of resource characteristics and addresses can be returned for the user agent (e.g., the 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 it. Any future requests should use the new URI.
302 Found Found. Similar to 301, but the resource is only temporarily moved. The client should continue using the original URI.
303 See Other See Other. Similar to 301. Uses GET and POST requests to view.
304 Not Modified Not Modified. The requested resource was not modified. When the server returns this code, it returns no resource. Clients usually cache visited resources and provide a header indicating they only want resources modified after a specified date.
305 Use Proxy Use Proxy. The requested resource must be accessed through a proxy.
306 Unused A deprecated HTTP status code
307 Temporary Redirect Temporary Redirect. Similar to 302. Uses GET to redirect.
400 Bad Request Bad Request. The client's request has a syntax error the server cannot understand.
401 Unauthorized Unauthorized. The request requires user authentication.
402 Payment Required Reserved for future use.
403 Forbidden Forbidden. The server understands the request but refuses to execute it.
404 Not Found Not Found. The server cannot find the resource (web page) based on the client's request. With this code, web designers can set a custom page saying "the requested resource could not be found".
405 Method Not Allowed Method Not Allowed. The method in the client's request is not allowed.
406 Not Acceptable Not Acceptable. The server cannot fulfill the request based on the content characteristics requested by the client.
407 Proxy Authentication Required Proxy Authentication Required. Similar to 401, but the requester must authenticate with the proxy.
408 Request Time-out Request Timeout. The server waited too long for the client's request and timed out.
409 Conflict Conflict. The server may return this code when completing the client's PUT request; a conflict occurred while processing the request.
410 Gone Gone. The resource requested by the client no longer exists. 410 differs from 404: if a resource previously existed but has been permanently deleted, 410 can be used, and the web designer can use 301 to specify the resource's new location.
411 Length Required Length Required. The server cannot process a client request that lacks a Content-Length.
412 Precondition Failed Precondition Failed. The precondition in the client's request is erroneous.
413 Request Entity Too Large Payload Too Large. Because the requested entity is too large, the server cannot process it and therefore rejects the request. To prevent repeated client requests, the server may close the connection. If the server is only temporarily unable to process, it includes a Retry-After response header.
414 Request-URI Too Large URI Too Long. The requested URI (usually a URL) is too long for the server to process.
415 Unsupported Media Type Unsupported Media Type. The server cannot process the media format attached to the request.
416 Requested range not satisfiable Range Not Satisfiable. The range requested by the client is invalid.
417 Expectation Failed. The server cannot meet the expected behavior specified in the Expect header field of the request.
418 I'm a teapot Status code 418 is actually an April Fools' joke. It is defined in RFC 2324, an RFC that 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 prank.
500 Internal Server Error Internal Server Error. The server encountered an internal error and could not complete the request.
501 Not Implemented Not Implemented. The server does not support the requested function and cannot complete the request.
502 Bad Gateway Bad Gateway. A server acting as a gateway or proxy received an invalid response from the remote server while trying to execute the request.
503 Service Unavailable Service Unavailable. The server is temporarily unable to process the client's request due to overload or maintenance. The length of the delay may be included in the server's Retry-After header.
504 Gateway Time-out Gateway Timeout. A server acting as a gateway or proxy did not get a timely response from the remote server.
505 HTTP Version not supported HTTP Version Not Supported. The server does not support the HTTP protocol version requested and cannot complete processing.