vdh_ant
vdh_ant

Reputation: 13176

ASP.NET MVC: OutputCache and http headers - Cache-Control

I have just started using OutputCache on some of my controller actions and I am not quite getting the response I would expect.

Basically I have set Location = OutputCacheLocation.Any and the http header is as follows:

Server              ASP.NET Development Server/9.0.0.0
Date                Wed, 15 Jul 2009 02:14:21 GMT
X-AspNet-Version    2.0.50727
X-AspNetMvc-Version 1.0
Content-Encoding    gzip
Cache-Control       private, max-age=3600
Expires             Wed, 15 Jul 2009 02:14:21 GMT
Last-Modified       Wed, 15 Jul 2009 02:14:20 GMT
Vary                *
Content-Type        text/html; charset=utf-8
Content-Length      640
Connection          Close

Now if my interpretation is correct the Cache-Control part being set to private means that it will only be cached on the client. I need to also be cached on any proxy.

I would have expected that by setting OutputCacheLocation.Any the Cache-Control would have been something like "public, max-age=3600". As far as I know the private means it will only be cached on the client and not by "Any" (i.e. proxies - see http://msdn.microsoft.com/en-us/library/system.web.httpcacheability.aspx).

Any ideas?

Cheers Anthony

Upvotes: 3

Views: 5859

Answers (1)

vdh_ant
vdh_ant

Reputation: 13176

See comments above for solution

EDIT

This comment was deemed the answer:

Have you tried publishing your site to IIS and looking at the headers there? Is it the same as on the dev server? –

Upvotes: 1

Related Questions