IIS 7 and Above
Set Expires Header by content type
Last post Mar 27, 2008 04:27 PM by anilr
Mar 26, 2008 02:57 AM|xgene|LINK
I'm not particularly adept with IIS and I'm having difficulty setting an expires header for static content in general and for .css files in specific.
I have downloaded the IIS & Admin tools, and using the configuration settings under system.webServer/staticContent I see that I can set various clientCache settings that presumably affect all static content.
a) It appears that I can only choose to either use MaxAge or Expires, not both (at least the cacheControlModule is binary in this regard).
b) I see no way to set expires by content type (to vary it for .css versus jpeg or whatever).
a) Is the Admin Tools Configuration Editor the right place to attempt to set this.
b) Is it possible to set both expires & max age for content type.
c) If you can set both HttpExpires & MaxAge, what is the format for Expires... can you do a now + x duration? Or do you need to set a specific date?
d) Can I, and if so how, do I go about varying this by content type.
Mar 26, 2008 03:42 PM|rlucero|LINK
Are you trying to adjust the expiration of cached content?
Mar 27, 2008 04:27 PM|anilr|LINK
You can only set max-age or expires, why would you want to do both, since one will win over the other anyway. Setting expires by content-type - this feature does not exist in IIS - I wrote a sample module to implement this some time back, but have not gotten
around to scrubbing and releasing the sample yet.