I've been trying to get client caching of images served by the media system in EpiServer working. Essentially I want to be able to set the Cache-Control:max-age header but nothing I've tried so far has made any difference to the value of this header. Currently I get a value of Cache-Control:public for all images in globalassets.
The following works for static files that are part of my project, meaning I get a Cache-Control value of max-age=604800 for those images:
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
But doesnt have any effect on files in globalassets.
I've also tried:
<staticFile expirationTime="8.0:0:0" />
But that doesnt work whether I put it inside a <location> (as below) or globally.
<staticFile expirationTime="365.0:0:0" />
Does anyone else know how this should be configured? Any help would be super appreciated!
That should do it but a sugestion is to remove the types of images as well in the static content section:
<!-- Image types -->
<mimeMap fileExtension=".jpg" mimeType="image/jpeg"/>
<mimeMap fileExtension=".png" mimeType="image/png"/>
Have you register this as well:
<section name="staticFile" type="EPiServer.Framework.Configuration.StaticFileSection" />
Thanks for your reply Eric. I tried removing the image types but still don't see any change in the response headers. I already had the section registered as well. Do you know of anything that might be overriding this?
We are using EpiServer 7.5 and I've heard the way the media system is configured has changed in this version but I can't find any information as to how to cache content served by the media system. I did find a post by someone else asking the same question without an answer but unfortunately haven't managed to find any advice on how to handle this in EpiServer 7.5.
Here's a link to the question:
The response headers I'm getting are below:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Date: Fri, 09 Dec 2016 10:03:09 GMT