Hi, i'm trying to custom the cache control header for my media files. But as i see, kentico cms added the Cache-Control header in to the response header. I'm try to remove it by the following code snippet in Application_BeginRequest function in global.ascx.cs file
if (context.Request.Path.ToLower().Contains("/getmedia/")) { context.Response.Headers.Remove("Cache-Control"); context.Response.Headers.Add("Cache-Control", "max-age=604800"); }
But i cannot see my value in the Cache-Control header. The value alwaysset as the default value from the CMS.
You can try this in web.config
<location path="getmedia"> <system.webServer> <httpProtocol> <customHeaders> <add name="Cache-Control" value="max-age=31536000" /> </customHeaders> </httpProtocol> </system.webServer>
Please, sign in to be able to submit a new answer.