Stop Episerver From Setting Cache-Control to Private
By default Episerver sets the header for Cache-Control to Private. You can see this by running curl
curl -kv -o /dev/null http://world.episerver.com/articles/items/relate-intranet-demo-site/
and the following is returned:
> HTTP/1.1 200 OK > Cache-Control: private > Content-Type: text/html; charset=utf-8 > ETag: "" > Server: Microsoft-IIS/7.5
This is a big deal if you want to put your site behind a CDN as the Cache-Control:private is telling your CDN not to cache the site. I got around this by adding the following to my base page.
var cache = System.Web.HttpContext.Current.Response.Cache; cache.SetCacheability(HttpCacheability.Public); cache.SetExpires(DateTime.UtcNow.AddMinutes(15));
This will set the cache-control header to public and sets the expiry to 15 minutes so it expires in the CDN every 15 mins.
Leave a Reply
Search
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
« Jan | ||||||
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |