Classification of HTTP status codes

Source: Internet
Author: User
Tags error status code

Status Code classification

HTTP status code is divided into five categories, currently we use the HTTP protocol version is 1.1, support the following status code. As the protocol progresses, more status codes are defined in the HTTP specification.

Tip: If you see a status code of 518, you don't know exactly what 518 means. At this point you just need to know 518 is (5XX, server error on it)

Defined range Classification
1XX 100-101 Information Tips
2XX 200-206 Success
3XX 300-305 redirect
4XX 400-415 Client Error
5XX 500-505 Server error

Common Status Codes

The average person just needs to know the following common status code is enough, if you want to learn more, please continue to look down.

The $ OK Server successfully processed the request (this is the most we have seen)
301/302 Moved Permanently (redirected) the URL of the request has been moved. A location URL should be included in the response to indicate where the resource is now located
304 not Modified (unmodified) the client's cache resource is up-to-date for clients to use the cache
404 Not Found resource not found
501 Internal Server error server encountered an error that prevented it from serving the request

1XX Informational Status Code

These status codes are introduced in HTTP 1.1. There is a debate about the value of these status codes (I have never seen these status codes, nor have I understood them.) )

Status code Status messages Meaning Instance
100 Continue (continued) The starting part of the request is received and the client should continue to request
101 Switching protocols (switching protocol) The server is switching the protocol to the Protocol listed in the update header based on the client's instructions

2XX Success Status Code

These requests are usually successful when the client initiates the request. The server has a set of status codes that are used to indicate success, corresponding to different types of requests.

Status code Status messages Meaning Instance
200 Ok The server successfully processed the request (this is the most we have seen) HTTP protocol Detailed-200
201 Created (created) The resource has been created for requests that require the server to create objects.
202 Accepted (accepted) The request has been accepted, but the server has not yet processed
203 Non-authoritative Information (non-authoritative information) The server has successfully processed the transaction, except that the entity header contains information that is not from the original server but from a copy of the resource.
204 No content (no contents) Response contains headers and a status line, but does not include the subject content of the entity (no response body) Status Code 204
205 Reset content (Reset contents) Another code that is primarily used for browsers. This means that the browser should reset all the HTML forms on the current page.
206 Partial content (partial) Partial request succeeded Status Code 206

3XX REDIRECT Status code

Redirect status codes are used to tell browser clients that the resources they access have been moved, that the Web server sends a redirect status code and an optional location Header, which tells the client where the new resource address is.

The browser client will automatically resend the new request with the address provided in location. This process is transparent to the user.

301 and 302 are very similar, one is permanent transfer, one is temporary transfer.

(SEO, if the search engine hit 301, such as Web page A with 301 redirect to Page B, the search engine can be sure that page a permanent change of address, will be the Web page B as the only effective target)

302,303,307 is the same. This is because 302 is defined by HTTP 1.0 and is used in HTTP1.1 303,307.  At the same time retained 302. ( But in reality, we still use 302, I have not seen 303 and 307)

So this section, we just need to master 302, 304 on it.

Status code Status messages Meaning Instance
300 Multiple Choices (multiple selection) The client requests a URL that actually points to multiple resources. This code is returned with a list of options, and then the user can choose the option he wants.
301 Moved permanently (permanently removed) The requested URL has been moved. A location URL should be included in the response to indicate where the resource is now located Status Code 301
60W Found (found) Similar to Status Code 301. But the removal here is temporary. The client will resend the new HTTP request using the URL given in the location HTTP protocol Detailed-302
303 See other Similar to 302
304 Not Modified (unmodified) The client's cache resource is up-to-date for clients to use the cache HTTP protocol Cache-304
305 Use proxy (using proxies) The resource must be accessed through a proxy, the address of the agent is in the location of response
60S Not used This status code is not currently used
307 Temporary Redirect (Temporary redirect Similar to 302

4XX Client Error status code

Sometimes the client sends something that the server cannot handle, such as a malformed request, or, most commonly, a URL that does not exist.

Status code Status messages Meaning Instance
400 Bad Request Tells the client that it sent an incorrect request. Status Code 400
401 Unauthorized (not authorized) Requires the client to authenticate itself Basic authentication of HTTP protocol-401
402 Payment Required (Requires payment) This state has not been used and is reserved for future use
403 Forbidden (Forbidden) The request was rejected by the server Status Code 403
50U Not Found (not found) Resource not Found HTTP protocol Detailed-404
405 Method not allowed (methods not allowed) The method of the request is not supported. Status Code 405
50W Not acceptable (unacceptable)
407 Proxy authentication Required (requires agent authentication) Similar to status code 401 for proxy servers that require authentication HTTP protocol Proxy-407
408 Request Timeout (requests timed out) If the client takes too long to complete the request, the server can echo the status code and close the connection
409 Conflict (conflict) The request caused some conflict on the resource
410 Gone (disappeared) The server used to have this resource, and now it's gone, similar to status code 404
411 Length Required (requires long indication) The server requires that Content-length be included in the request. Status Code 411
412 Precondition Failed (Prerequisite failure)
413 Request entity Too Large (requesting entities too large) The entity body part sent by the client is larger than the server can or wants to handle Status Code 413
414 Request URI Too Long (requests URI is too lengthy) The client sends a request with a URL that exceeds the length that the server can or wants to process Status Code 414
415 Unsupported media type (not supported) The server does not understand or does not support the content type of the entity sent by the client
416 Requested range not satisfiable (the requested range is not met)
417 Expectation Failed (unable to meet expectations)

5XX Server Error Status code

Sometimes the client sends a valid request, and the Web server itself has an error.  Either the Web server is running in error or the Web site is dead. 5XX is used to describe a server error.

Status code Status messages Meaning Instance
500 Internal Server error (internal server errors) The server encountered an error that prevented it from serving the request Status Code 500
501 Not implemented (not implemented) This status code is used when a client-initiated request exceeds the capabilities of the server (for example, using a request method that is not supported by the server). Status Code 501
502 Bad Gateway (gateways fail) The server used by the agent encountered an invalid upstream response Status Code 502
503 Service Unavailable (not available) The server is currently unable to service the request, but can recover the service over time
504 Gateway Timeout (gateways timed out) Similar to the status 408, but the response comes from the gateway or proxy, and this gateway or proxy has timed out while waiting for the response from another server
505 HTTP version not supported (HTTP versions not supported) The server received a request that uses an HTTP protocol version that it does not support. Some servers do not support HTTP earlier HTTP protocol versions, nor do they support too high protocol versions Status Code 505

Classification of HTTP status codes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.