HTTP Cache Correlation

Source: Internet
Author: User

First, share the header settings when the file is forced to download in CI.

[php "View plain Copy if (Strpos ($_server[' http_user_agent ']," MSIE ")!== FALSE)                  {Header (' Content-type: '. $mime. ');                  Header (' content-disposition:attachment; Filename= '. $filename. ');                  Header (' expires:0 ');                  Header (' Cache-control:must-revalidate, post-check=0, pre-check=0 ');                  Header ("Content-transfer-encoding:binary");                  Header (' Pragma:public ');              Header ("Content-length:". strlen ($data));                  } else {header (' Content-type: '. $mime. ' ");                  Header (' content-disposition:attachment; Filename= '. $filename. ');                  Header ("Content-transfer-encoding:binary");                  Header (' expires:0 ');                  Header (' Pragma:no-cache ');              Header ("Content-length:". strlen ($data)); }  

Others are better understood, mainly about the settings of Cache-control and pragma to make people more confused.

About Cache-control's must-revalidate: forcing pages to not cache, the same action as No-cache, but more stringent, mandatory means more obvious. For detailed functions, please refer to: http://hi.baidu.com/chenleibupt/blog/item/9627bec6932e5a179c163df2.html

About Post-check and pre-check:internet Explorer 5 use two new interval indications for HTTP header information: Pre-Check and Post-check. The Pre-Check extension defines a time interval, in seconds, after which an object should be selected for updating before it is displayed to the user. The selected object can also occur after the object has been displayed to the user, but ensure that the cached copy is updated the next time the user wants to see the object. The Post-check extension defines a time interval, in seconds, after which the object is selected for updating before it is displayed to the user. That is, Post-check=0,pre-check=0 is a IE5.0-only cache declaration. (Reference from http://bbs.chinaunix.net/thread-704320-1-1.html and http://blog.sina.com.cn/s/blog_5595d51401000b23.html)

About Pragma:no-cache, same as Cache-control:no-cache. Pragma:no-cache is compatible with HTTP 1.0, Cache-control:no-cache is provided with HTTP 1.1. Therefore, Pragma:no-cache can be applied to HTTP 1.0 and HTTP 1.1, while Cache-control:no-cache can only be applied to HTTP 1.1.

About the Pragma:public role is unknown, please also read this article of the heroes to give explanations.

HTTP Cache Correlation

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.