Controlling HTTP Host Headers (cache control) In Kentico

jeff McDaniel asked on October 17, 2018 19:41

Hi,

I recently got a request to set the cache-control header in our Kentico application to no-cache.

I've been trying to set the HTTP Header in my web.config file and IIS Settings, but it always comes back as Cache-Control: private, no-store, must-revalidate, no matter what I try.

Is there a way to do this through Kentico? Could it be possible something through Kentico, or our C# code could be controlling these headers?

I'm using Kentico 11 and IIS 8.0.

Thanks for any suggestions!

Recent Answers


Peter Mogilnitski answered on October 17, 2018 20:29 (last edited on October 17, 2018 20:49)

You can go to settings -> system -> perfomance -> client caching. Here is the documentation

This setting only applies to dynamic files that are managed by the Kentico application, for example stylesheets in the CSS stylesheets application. Physical files stored on the file system may use a different client cache expiration time:

  • Physical files served by the Kentico application through the GetResource.ashx handler use the CMSPhysicalFilesCacheMinutes web.config key. The default value is one week.
  • Files that are requested directly use the IIS client cache configuration.
0 votesVote for this answer Mark as a Correct answer

jeff McDaniel answered on October 17, 2018 21:31

Hey Peter,

Thanks for the response! I've set that and disabled all caching in that area just to see what would happen. It looks like that didn't affect the cache-control at all, as it still has the same values. Do you have any other suggestions I can look at?

0 votesVote for this answer Mark as a Correct answer

jeff McDaniel answered on October 17, 2018 21:33

A better question might be - is there a way to just let Kentico use the HTTP Host headers set in the web.config/IIS?

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on October 18, 2018 03:19 (last edited on October 18, 2018 13:08)

it is more IIS than Kentico. you can try in web.config for static content. you can do at at IIS level by going to response headers but it adds to headers it does not overwrite it. you can do in c# as well try to set in in global events.

0 votesVote for this answer Mark as a Correct answer

jeff McDaniel answered on October 18, 2018 17:28

Thanks Peter! I'll take a look, appreciate the support.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.