[Zope-CMF] IE Cache Bug and CachingPolicyManager
Geoff Davis
geoff at phds.org
Wed Sep 28 11:51:50 EDT 2005
In testing all the new caching code, I ran into a fairly nasty IE bug:
IE pays attention (more or less) to the Cache-Control header when it comes
to requesting new content from the server. The "more-or-less" part is
because IE 5.5+ introduces some proprietary Cache-Control tokens,
pre-check and post-check, that let IE ignore the headers to some extent (see
http://msdn.microsoft.com/workshop/author/perf/perftips.asp ).
Fortunately, this behavior can be turned off by setting Cache-Control:
pre-check=0, post-check=0
The problem is that after the page has been requested, IE doesn't
necessarily actually render it. If you have a page with a Last-Modified
tag, under some (all?) circumstances, IE will render what it has in cache
rather than what it has just requested. My guess is that there is a bug
in IE that causes its internal Last-Modified freshness heuristics to
override explicit Cache-Control freshness declarations and that it pulls
the cached page from the wrong place or at the wrong time. It was
difficult to track down, but straightforward to work around: I modified
CMFCore/CachingPolicyManager.py to allow you to disable the Last-Modified
header. To preserve backward compatibility, Last-Modified is on by
default, but you can now explicitly disable it. I have also added the
ability to set the pre-check and post-check tokens.
As an aside, a very useful tool for working with caching and IE is
Fiddler: http://www.fiddlertool.com/fiddler/
It's basically the equivalent of LiveHTTPHeaders for IE.
I am checking the fixes (with tests) into the 1.5 branch, and Sidnei has
volunteered to backport them to CMF 1.4.
Geoff
More information about the Zope-CMF
mailing list