ETag Cache Control

Source: Internet
Author: User

Https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=zh-cn


The only thing we have to do is make sure the server provides the necessary ETag tokens. Check your server documentation for any configuration flags that are not necessary.
There is no etag is the server configuration,

    • Each resource can define its cache policy through the Cache-control HTTP header
    • The Cache-control directive controls who can cache responses under what conditions and can cache multiple

The HTTP specification allows the server to return Cache-control directives that control how the browser and other intermediate caches cache individual responses and how long the cache is cached.
Note: The Cache-control header is defined in the http/1.1 specification, replacing the header (such as Expires) that was previously used to define the response cache policy. All modern browsers support Cache-control, so it's enough to use it.

"No-cache" and "No-store"

"No-cache" means that you must first confirm with the server whether the returned response has changed before you can use the response to satisfy subsequent requests for the same URL. Therefore, if there is an appropriate authentication token (ETAG), No-cache initiates a round-trip communication to validate the cached response, but avoids the download if the resource has not changed.

By contrast, "No-store" is much simpler. It directly prohibits the browser and all intermediate caches from storing any version of the return response, such as a response that contains personal privacy data or bank business data. Each time a user requests the asset, it sends a request to the server and downloads the full response.

"Public" and "private"

If the response is marked as "public", the response can be cached even if it has associated HTTP authentication, and even the response status code is usually not cached. In most cases, "public" is not required because explicit cache information (such as "Max-age") has indicated that the response is cacheable.

By contrast, browsers can cache "private" responses. However, these responses are usually cached only for a single user, so no intermediate caches are allowed to cache them. For example, a user's browser can cache HTML pages that contain user private information, but the CDN cannot cache.

"Max-age"

max-age=86400 The browser and any intermediate caches can cache the response (if it is a "public" response) for up to 1 days (60 seconds x 60 Minutes x 24 hours).
Private, max-age=600 The client's browser can only cache the response for a maximum of 10 minutes (60 seconds x 10 minutes).
No-store Cached responses are not allowed, and each request must be fully fetched.

ETag Cache Control

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.