Full version HTTP status code reference
Most of the sorting of HTTP status codes is in the order of 1xx~5xx. This paper breaks the old rules and displays them from 5XX to 1XX.
Introduction to the
In most cases, 5XX status codes are more common and have more serious implications. Four of them, such as 502 (Bad Gateway), 503 (Service Unavailable), 504 (Gateway Timeout) and 500 (Internal Server Error), are most common, followed by 4XX. However, the majority of well-experienced sites will handle errors like 404 and instead display friendly “lost page” pages. However, 3XX status codes are generally not directly displayed on web pages, because their essential function is to inform clients of resource request redirection, so most of them are directly executed implicitly. For example, 301 is generally used for website domain name replacement of the new address automatically jump; 302 will automatically jump to the login page when users browse the web page that they need to log in to; The 304 will avoid rerequesting an already cached resource when the browser accesses it, instead reading directly from the local cache.
Common status code
5xx(Server error)
- 500: Server unknown error
- 502: The server, as the gateway, should get a response to process the request, but gets an error response
- 503: Server down for maintenance or heavy load
- 504: The server functions as the gateway and cannot receive timely response
4xx(client error)
- 400: the semantics are wrong, the current request cannot be understood by the server (the client should not resubmit the request unless it is modified)/the request parameters are wrong
- 401: Current request requires user authentication
- 403: The server understands the request, but refuses to execute it
- 404: Requested resource not found on server
- 405: Request methods cannot be used to request responding resources (PUT/DELETE writes to server resources, so most web servers do not allow PUT/DELETE requests by default)
- 410: The requested resource is unavailable on the server and has no known forwarding address
- 411: The server refuses to accept requests without defining the Content-Length header
- 413: The server refused to process the current request because the entity data submitted by the request is larger than the server is willing or able to process
- 414: Request URIs longer than the server can interpret (e.g., GET instead of POST, resulting in Query String too long)
- 416: The request contains a Range header, and any data Range specified in Range does not coincide with the available Range of the current resource, and no if-range header is defined
- 426: The server refuses to execute the request using the current protocol, but may be willing to accept it after upgrading to another protocol, and the server sends the Upgrade header in response to indicate the desired protocol
- 429: User sends too many requests in a given amount of time (limit request rate)
3xx(Redirection)
- 301: Resource permanently moved to new location
- 302: The requested resource now temporarily responds to the request from a different URI (some older clients mistakenly convert the request method to GET)
- 304: The client sends a conditional GET request and the request is allowed, while the document content has not changed since the last access or according to the condition of the request (response disallows message body and always ends with the first blank line after the header of the message)
- 307: Temporary redirect, same as 302, but ensure that the request method and message body do not change when sending a redirect request
- 308: Permanent redirection, same as 301, but the user agent cannot change the HTTP method used
2xx(Successful response)
- 200: The request succeeded. The meaning of success depends on the HTTP method
- 204: The server successfully processed the request, but does not need to return any physical content, and wants to return updated meta information (does not return any message body, always ends with the first empty line after the header)
- 205: The server has successfully processed the request without returning anything, requiring the requester to reset the document view (mainly used to reset the form immediately after receiving user input)
- 206: The server has successfully processed some OF the GET requests (such as resumable breakpoints or splitting large documents into multiple downloads at the same time, the request must contain the Range header to indicate the Range of content the client wants, and may include if-range as the request condition)
1XX (Information response)
- 100: Everything is currently available and the client should continue to request
- 101: The Upgrade label sent in response to the client and indicates that the server is also switching protocols
- 102: The server has received and is processing the request, but no response is available
Uncommon status code
5xx
- 501: The HTTP request method is not supported by the server and cannot be processed (GET and POST require server support and will not return this code)
- 505: The server does not support the HTTP protocol version used in the request
- 506: The server has an internal configuration error (transparent content negotiation of the request causes circular references)
- 507: Server has an internal configuration error (the selected variant resource is configured to participate in transparent content negotiation itself and is therefore not the appropriate endpoint during negotiation)
- 508: The server detected an infinite loop while processing the request
- 510: The client needs to extend the request further before the server can implement it (the server replies with all the information the client needs to extend the request)
- 511: indicates that the client needs to authenticate to gain network access
4xx
- 402: Reserved status code, originally intended for digital payment systems, but not used
- 406: The content properties of the request resource do not satisfy the condition in the request header and therefore cannot generate the response entity
- 407: Clients must authenticate on the proxy server
- 408: Request timeout (the client does not complete the request within the time the server is waiting)
- 409: The request cannot be completed because the request conflicts with the current status of the requested resource
- 412: The server failed to satisfy one or more of the prerequisites given in the request header field while verifying
- 415: For the method currently requested and the resource requested, the submitted entity in the request is not in a format supported by the server
- 417: The server cannot meet the expected value indicated by Expect’s request header field
- 418:I’m a teapot
- 421: Unable to generate a response server
- 422: The request was well formed but could not be followed due to semantic errors
- 423: The resource being accessed is locked
- 424: This request failed because a previous request failed
- 425: The server does not want to take the risk of processing possible replay requests
- 428: The original server requires the request to be conditional
- 431: The server does not want to process the request because the request header field is too large
- 451: User requests illegal resources (e.g. web pages censored by the government)
3xx
- 300: The requested resource has a selection of feedback messages, each with its own specific address and browser-driven negotiation messages. The user or browser can choose a preferred address for redirection
- 303: The response to the current request can be found on another URI, and the client should access that resource using GET (mainly to allow the output of the POST request activated by the script to be redirected to a new resource)
- 305: Resources must be accessed through a specified agent
- 306: not used. The new protocol is no longer used
2xx
- 201: The request was successful and a new resource was created as a result (usually returned after POST, or some PUT requests)
- 202: Request received but not yet responded, no result (meaning there is no asynchronous response to indicate the result of the current request, other processes and services are expected to process the request, or batch)
- 203: The server has successfully processed the request, but the entity header meta-information returned is not a valid set of identified information on the original server, but a copy from a local or third party
- 207: Indicates that the subsequent message body will be an XML message and may contain a series of independent response codes depending on the number of previous sub-requests
- 208: Used in DAV, propstat response element to avoid repeatedly enumerating multiple bound internal members into the same collection
- 226: The server has completed a GET request for a resource, and the response is a representation of the result of one or more instance operations applied to the current instance
1xx
- 103: Used primarily with the Link header to allow the user agent to start preloading resources while the server is still preparing a response
Mining association between status codes
206 and 416 (Some resources)
Breakpoint continuation is implemented using 206 status codes, and 416 occurs If an error occurs in the declared Range and if-range is not prechecked
301 and 308, 302 and 307 (redirect)
308 is an enhancement to 301 and 307 is an enhancement to 302 to ensure that the request method and message body are not changed when redirected
502 and 504 (gateway related)
These two are the status codes of response when the server acts as the gateway. 502 indicates that the gateway clearly received an error response from the server, and 504 indicates that timeout occurred while waiting for the response from the server
101 and 426 (Protocol Upgrade)
Both 101 and 426 are used to Upgrade protocols. That is, the current HTTP protocol does not meet actual requirements. For example, websocket uses the Upgrade header to Upgrade protocols
305 and 407 (agency related)
Both status codes are proxy-related. 305 indicates that a resource must be accessed by a proxy and therefore a redirect is initiated, and 407 indicates that a proxy is required for authentication
408 and 504 (timeout related)
408 indicates that the request from the client times out. 504 indicates that the gateway server times out while waiting for the response from the server
Cold knowledge
418
418 says “I am a teapot and refuse to make coffee”, indicating that the client is asking the server to do something it shouldn’t. This is an April Fool’s day spoof protocol, see Spoof RFC
The sample
Refer to official documentation
- HTTP response code
- section 10 of RFC 2616