HTTP Common Status Code parsing

Source: Internet
Author: User
Tags 303 status code http redirect

Overview
    • 1XX: Indication information--Indicates that the request has been received and continues processing

    • 2XX: Success-Indicates that the request has been successfully received, understood, accepted

    • 3XX: Redirect--further action is required to complete the request

    • 4XX: Client Error--Request syntax error or request not implemented

    • 5XX: Server-side error-the server failed to implement a legitimate request

Common HTTP status Codes
  • OK
    Indicates the request was successful, everything works.

  • 301 Moved Permanently
    Redirect, the customer requests the document elsewhere, the new URL is given in the location header, and the browser should automatically access the new URL

  • 302 Found
    Temporary redirection, similar to 301, but the new URL should be treated as a temporary replacement instead of permanent.

  • 304 Not Modified
    The client has a buffered document and makes a conditional request. The server tells the customer that the original buffered document can continue to be used.

  • 307 Temporary Redirect
    Temporary redirection, similar to 302, only enforces the use of the Post method.

  • Request
    A syntax error occurred in the request.

  • 401 Unauthorized
    The customer attempted to access a password-protected page without authorization. A www-authenticate header is included in the answer, and the browser displays the user name/Password dialog box, and then makes a request again after filling in the appropriate authorization header.

  • 403 Forbidden
    The resource is not available. The server understands the customer's request, but refuses to process it. Typically due to file or directory permission settings on the server

  • 404 Not Found
    The resource at the specified location could not be found.

  • 405 Method not allowed
    The request method (GET, POST, HEAD, Delete, PUT, Trace, and so on) does not apply to the specified resource.

  • Internal Server Error
    The server encountered an unexpected situation and could not complete the customer's request.

  • 501 Not implemented
    The server does not support the functionality required to implement the request.

  • 502 Bad Gateway
    When the server acts as a gateway or proxy, the server returns an illegal response in order to complete the request to access the next server.

3XX Status Code explanation

301 Status Code (Moved permanently)
The 301 Status codes represent permanent redirects in the HTTP1.0 and HTTP1.1 specifications, for redirection of Post requests, for redirection after user confirmation, and for redirection requests to be made with the Post method.
The issue of the POST request redirect user confirmation, in fact the browser is not implemented, and the redirection of the POST request should initiate a POST request, where the browser does not necessarily adhere to, so that the HTTP specification implementation is not strictly in accordance with the semantics of the HTTP specification.

302 Status Code (Moved temporatily)
In the HTTP 1.0 specification, 302 represents a temporary redirect. When the status code appears, the browser can automatically access the new URL.
Specification: The original request is get, can be automatically redirected, the original request is post, you cannot automatically redirect.
Implementation: The browser and server implementations do not strictly adhere to the HTTP 302 specification, the browser even if the original request is post will automatically redirect, resulting in the specification and implementation of two semantics, resulting in a number of issues, such as 302 hijacking, so in the HTTP 1.1 The specification of 302 is refined into 303 and 307, in the hope of eliminating ambiguity.

Supplement: 302 hijacking--a station by redirecting to B station Resources Xxoo,a station actually did nothing but a friendly domain name, web resource Xxoo exists B station and is provided by B station, but B station domain is not so friendly, so for search engine, May save the address of a station corresponding to the XXOO resource instead of B station, which means that B station out of resources copyright, bandwidth, server money, but users through search engine search Xxoo resources when come out is a station, a station nothing did but was search engine advertise users, B station did everything but not by users know, The value was stolen by a station.

303 status code (see other)
Inherits the implementation of HTTP 1.0 in 302: Automatic redirection regardless of whether the original request is GET or post
303 responses should be disabled from being cached. The redirection may be cached accordingly.

307 Status Code
Inherited the specification of HTTP 1.0 in 302: The original request is get or HEAD, the browser can automatically redirect, the original request is POST, you cannot automatically redirect.

302, 303, 307 Status code discrimination
In HTTP 1.1, 302 is no longer recommended, but is reserved for compatibility. In order to refine the semantics of HTTP1.0 in 302, HTTP1.1 introduced 303 and 307, mainly in response to non-get, head methods, and for GET and head requests, can be automatically redirected.

In the these powers, such as the request way, 302, 303, 307 no difference, and for the post is different, most of the browser's 302 will be the POST request to get, and the 303 specification force post to get request, the request address header LOCATION,307, the specification requires the browser to continue to POST content to the location's address.

?? The existence of 303 and 307 is, in the final analysis, caused by the non-idempotent properties of the POST method.

Reference

HTTP status Code
HTTP status Code
HTTP status Code detailed
HTTP REDIRECT 301/302/303/307

HTTP Common Status Code parsing

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.