I’m serving up some files via an HTTPModule in asp.net. I want to know if there are any benefits to setting, or not setting, the Cache-Control header to something (like no-cache)?
Edit: The reason I’m curious about this is because we ran in to a problem where serving up office documents over an SSL session in IE results in an error (with Cache Control set to no-cache). That is to say, you cannot download office docs over SSL in IE if you have set Cache-Control to no-cache.
Basically I want to NOT include the Cache-Control header, but wonder if it will cause problems?
Edit 2: Well, the Cache-Control header is out. I tried the suggestions below but had some problems. Any time I add an expires header, or change Cache-Control at all, when I try and open an Office 2007 document it tries to open it as a zip. (I know that they’re really zip files under the covers) but when I don’t use an expires header or cache-control IE opens them just fine as Office Documents. Unfortunately I don’t have time to try and figure all this out – as code freeze is ten minutes from now 🙂
Thanks everyone for trying to help!
According to Yahoo! and YSlow you should. See this article.
Update: Based on your comment it looks like you are trying to prevent caching. I would use:
To me, it’s simpler and more explicit than using an Expires header.
Update 2: Sounds like you need to specify the Content-Type header for the office documents. Try using below: