HTTP response Header Cache control

Source: Internet
Author: User

In general web development, it is sometimes necessary to set a special HTTP response header to prevent a client (typically a browser) from caching (using) the response of that request.

At this time most developers are Baidu or Google a few pieces of code to copy and paste the matter.

The following is a brief description of the actual role of several HTTP response headers for cache control.

1 //prevents clients from replicating the contents of the response to the cache area2 Header(' Cache-control:no-store ');3 4 //the next time the client requests cache validity validation, the corresponding result is not used5 Header(' Cache-control:no-cache ');6 7 //Set Cache validity period is 0, client next request does not use cache8 Header(' Cache-control:max-age=0 ');9 Ten //The next time the client requests, the cache validity must be re-validated and reused One Header(' cache-control:must-revalidate ');

Attention:

Expires:xxxxx the response header in this format is also available, but is not recommended because the value is the actual expiration time rather than the time remaining, but the client and server time are not necessarily consistent.

HTTP response Header 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.