HTTP protocol status code and its significance

Source: Internet
Author: User
Tags error status code

What is a status code?

The function of the status code is: The server tells the client what happened.

The status code in the HTTP protocol is now the first line of HTTP response. It returns a three-digit status code and status information. Status code to facilitate the process of processing, and state information is to allow users to clearly understand the meaning.

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 503, you don't know exactly what 503 means. At this point you just need to know 503 is (5XX, server error on it)

Usually some of the common status codes are this:

1 XX: Indicates informational hints

2XX: Indicates success

3XX: redirect

4XX: Client error occurred

5XX: Server error occurred

Here are some common status code specific meanings:

The $ OK Server successfully processed the request.

301 and 302 Moved Permanently (redirected) the URL of the requested resource has been removed, and a location URL is taken in the response to tell you where the resource is now located.

304 Not modified (unmodified) means that the resources used by the client are brand new and require the client to use the cache.

404 Not Found did not find the requested resource.

Internal Server error Server encountered an error that prevented it from processing the request.

More status codes are as follows:

1XX Informational Status Code

The continue continues to receive the starting part of the request and the client should continue the request.

101 Switching protocols: protocol switching. Depending on the client, the server simply switches the protocol to the Protocol listed in the header.

2XX Success Status Code

The $ OK Server successfully processed the request.

201 created those requests that require services to create objects, the resources have been created.

The 202 Accepted request was accepted, but the server has not yet been processed.

203 non--authoritive Information (non-authoritative information) The request has been processed successfully, but the information in the header is not from the original server, but from a copy of the resource.

204 no content (no contents) response contains some headers and a status line, but does not include the subject content of the entity (no response body)

205 Reset Content (reset contents) a code that is primarily used for the browser. This means that the browser should reset all the HTML forms on the current page.

206 part content (partial) Partial request succeeded

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. (In our opinion, these two are not much different)

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 haven't seen 303 and 307)

The URL of the
+ multiple Choices (multiple selection)   client requests a URL that actually points to multiple resources. This code is returned with a list of options, and then the user can select the option he wants  
301 Moved permanently (permanently removed) request was moved. The response should contain a location URL that states where the resource is now status Code 301
302 Found (found) Code 301 is similar. But the removal here is temporary. The client uses the URL given in the location to resend the new HTTP request HTTP protocol in detail -302
303  see Other (see Other) similar to 302  
304 not Modified (unmodified) customer's cache resource is up-to-date, guest Cache for client using cached http protocol -304
305  use proxy (using proxy) must access resources through a proxy, the address of the agent Response location  
306   not used   This status code is not currently used  
307 Temporary Redirect (temporary redirection like 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
60s 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
404 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)
50V 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
40S 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

HTTP protocol status code and its significance

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.