how to set cache control to public in iis 7.5

Posted by ivymike on Server Fault See other posts from Server Fault or by ivymike
Published on 2012-03-20T09:59:51Z Indexed on 2012/03/20 11:32 UTC
Read the original article Hit count: 342

Filed under:
|
|

I'm trying to set cache control header to max age using the following snippet in my web.config:

<system.webServer>
  <staticContent>
    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
  </staticContent>
</system.webServer>

Some how this isn't being reflected in the response. Instead I see a Cache-Control: private header on the responses. I'm using NancyFx framework (which is a layer on top of Asp.net). Is there any thing else I need to do ?

Below are the reponse headers I receive:

HTTP/1.1 200 OK\r\n
Cache-Control: private\r\n
Content-Type: application/x-javascript\r\n
Content-Encoding: gzip\r\n
Last-Modified: Mon, 19 Mar 2012 16:42:03 GMT\r\n
ETag: 8ced406593e38e7\r\n
Vary: Accept-Encoding\r\n
Server: Microsoft-IIS/7.5\r\n
Nancy-Version: 0.9.0.0\r\n
Set-Cookie: NCSRF=AAEAAAD%2f%2f%2f%2f%2fAQAAAAAAAAAMAgAAADxOYW5jeSwgVmVyc2lvbj0wLjkuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwFAQAAABhOYW5jeS5TZWN1cml0eS5Dc3JmVG9rZW4DAAAAHDxSYW5kb21CeXRlcz5rX19CYWNraW5nRmllbGQcPENyZWF0ZWREYXRlPmtfX0JhY2tpbmdGaWVsZBU8SG1hYz5rX19CYWNraW5nRmllbGQHAAcCDQICAAAACQMAAADTubwoldTOiAkEAAAADwMAAAAKAAAAAkpT5d9aTSzL3BAPBAAAACAAAAACPUCyrmSXQhkp%2bfrDz7lZa7O7ja%2fIg7HV9AW6RbPPRLYLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%3d; path=/; HttpOnly\r\n
X-AspNet-Version: 4.0.30319\r\n
Date: Tue, 20 Mar 2012 09:44:20 GMT\r\n
Content-Length: 1624\r\n

© Server Fault or respective owner

Related posts about iis

Related posts about iis7.5