I have a resource which is user generated and therefore changes at an unpredictable time (example, a user uploads a new version of a word document). I would like browsers to cache this resource and validate its cache with the server on each request (i.e. always send the If-Modified-Since header).
From testing, I've found that Firefox handles this appropriately when I use "Cache-Control: no-cache" in the response header. However, Internet Explorer 7 is not sending "If-Modified-Since" in its request header.
Does "Cache-Control: no-cache" achieve what I described at the beginning? If not, is there anything I can do differently to achieve what I've described across browsers?
Thanks.
According to Microsoft (http://support.microsoft.com/kb/234067), you need to set the Expires header for -1 for this to work properly in Internet Explorer.
From the page:
I think the point is that if IE has an expiration date, it sees no reason to ask you if the resource has been modified, since its cached copy should be "good enough".
The page does also say that IE supports Cache-control: no-cache, though it isn't recommended. So it sounds like it should work, but try the Expires thing anyway.
Also, other googling tells me that browsers are expected to send If-Modified-Since in general, so maybe that's why Firefox works. Try removing Cache-Control: no-cache to see if Firefox still behaves correctly.