Http_4 a new HTTP status code: 428, 429, 431, 511

Source: Internet
Author: User

1.428 Precondition Required (prerequisites required)

Prerequisites are some of the preset conditions that a client must meet when sending an HTTP request. A good example of this is the If-none-match header, which is often used in GET requests. If If-none-match is specified, the client receives the response only after the ETAG in the response has changed.

Another example of a prerequisite is the If-match header, which is typically used on put requests to indicate resources that are only updated but not changed. This is used when multiple clients use HTTP services to prevent the same content from being overwritten by each other.

When the server side uses the 428 precondition Required status code, it means that the client must send the above request header to perform the request operation. This method provides an effective way for the server to prevent the "lost update" issue from appearing.

2, 429 Too Many requests (too many requests)

This status code is useful when you need to limit the number of requests a service has to a client, that is, to limit the speed of the request. Prior to this, there were some similar status codes. For example "509 Bandwidth Limit exceeded".

If you want to limit the number of client requests to a service, you can use a 429 status code and include a retry-after response header to tell the client how long it will take to request the service again.

3, 431 request header fields Too Large (Request header field is too large)

In some cases, the client sends the HTTP request header to become very large, then the server can send 431 request header fields Too Large to indicate the problem.

I am not quite sure why there is no 430 status code, but jump straight from 429 to 431, I try to search but no results. The only guess is 430 Forbidden and 403 Forbidden too like, in order to avoid confusion to do so, God knows!

4, 511 network authentication Required (authentication required)

This status code is interesting to me, and if you're developing an HTTP server, you don't have to deal with that status code, but if you're writing an HTTP client, the status code is very important.

If you use laptops and smartphones frequently, you may notice that a large number of public Wifi services require you to accept some protocol or must be logged in before you can use it, which is achieved by blocking HTTP traffic. This is annoying when users try to access the network and return a redirect and login, but that's the case.

With these "intercept" clients, there are some nasty side effects. The following two examples are mentioned in the RFC:

    • If you visit a website before you log in to WiFi, the network device will intercept the first request, and these devices often have their own website icon "Favicon.ico". After logging in you will find that for a period of time you visit the website icon has been the WiFi login website icon.
    • If a client uses an HTTP request to find a document, the network responds to a login page so that your client resolves the error and causes the client to run the exception, which is a common problem in reality.

The 511 status code was proposed to solve the problem. Therefore, if you are writing an HTTP client, you might want to check the 511 status code to verify that authentication is required before you can access it.

Http_4 a new HTTP status code: 428, 429, 431, 511

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.