문제

I'm developing an application that utilizes PDFLib to serve my users dynamic PDF files summarizing their accounts and need to ensure that these pages are not being cached (some sensitive data is passed, and I can't have that stored in cache for security reasons).

I have tried using the following code:

Header("Expires:-1");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate");
Header("Cache-Control: post-check=0, pre-check=0", false);
Header("Pragma:no-cache");

First of all, I have no surefire way of testing that IE7 is not caching the page, so my first question is "how do I test to ensure that my no-cache headers are working?"

Secondly, after I added these lines to my code, the PDF ceased displaying in IE7. When I remove the lines, it works fine. Anyone have any ideas on how to avoid this behavior?

Thanks in advance!

Edit: The first question has been answered; I should have asked them separately. My second question of "How do I avoid IE7's behavior of not rendering my PDFLib page when the no-cache headers are sent?" is still active.

도움이 되었습니까?

해결책

To check if the page is cached, change it and refresh. Note that the Expires header should contain a date, so the value of -1 is invalid. Try using a date in the past instead.

다른 팁

I actually found Debug Bar http://www.debugbar.com/download.php for IE 7 that shows me all the headers and caching information. I use the HTTP(S) tab, select my document and view "Info & Cache" below. Really easy once I got the hang of it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top