Prevent Cache-Control: private

Vote:
 

Hey,

So I have spent quite a few hours trying to work out why my website insits on adding Cache-Control: private to all requests.  For dynamic content I don't want it set to private so that my CDN will cache those pages.  If you bring up a bash window you can check the header using:

curl -kv -o /dev/null http://world.episerver.com/articles/items/relate-intranet-demo-site/

All the Episerver demo sites come back with:

< HTTP/1.1 200 OK
< Cache-Control: private
< Content-Type: text/html; charset=utf-8
< ETag: ""
< Server: Microsoft-IIS/7.5

I have tried editing Episerver.config,  I have tried removing it and readding it using customheaders but the best I can get to is Cache-control:private, public.  Has anyone managed to find out where the private is being added?

Thanks

Adam

#142529
Dec 13, 2015 14:23
Vote:
 

Which version are you using? 

If you are on an older version and using Web Forms the source code for PageBase contains SetCachePolicy() and can be found here:
http://sdk.episerver.com/library/cms6.1/html/T_EPiServer_PageBase.htm

I recall you get private if you are signed in or running it on localhost.

#142610
Edited, Dec 16, 2015 8:50
Vote:
 

Hi Johan,

I overcame this by using this in my base page

var cache = System.Web.HttpContext.Current.Response.Cache;
 
cache.SetCacheability(HttpCacheability.Public);
cache.SetExpires(DateTime.UtcNow.AddMinutes(15));
#143443
Edited, Jan 24, 2016 21:11
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.