Disabling private cache for Sitecore pages not working on Sitecore 8.1 and 8.2

A while ago I had an issue with Sitecore 8.1 update 2 where I was getting “Cache-Control: private” set from Sitecore, even when <setting name=”DisableBrowserCaching” /> is set to true.  I was also able to replicate this up to 8.2 update 5.

Based on the docs here Sitecore is meant to return “Cache-Control: no-cache, no-store Pragma: no-cache” when DisableBrowserCaching is set to true.

I raised this issue to Sitecore Support and they eventually confirmed they could replicate the issue. There wasn’t a fix for it yet though so I ended up implementing my own. The reference number from Sitecore for this issue is: #116813.

I meant to blog about this a while ago but didn’t get round to it and then someone on Sitecore Stack Exchange had the same issue this week and it looks like there may still not be an official patch for it so I’ve put my code below to help others who come across this issue.

Add an Custom Pipeline

 

Patch in the Pipeline

<mvc.getPageRendering>
<processor patch:after=”*[type=’Sitecore.Mvc.Pipelines.Response.GetPageRendering.GetLayoutRendering, Sitecore.Mvc’]” type=”Custom.Sitecore.Extensions.Pipelines.MvcBrowserCaching, Custom.Sitecore.Extensions” />
</mvc.getPageRendering

Published by

Adam Seabridge

I am a Freelance Sitecore Developer and 7x Sitecore Technology MVP (2024 - 2018). I have been working with Sitecore since 2013. You can reach me on twitter @billyjava or comment below if you have any questions or feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *