Try our conversational search powered by Generative AI!

EpiServer 7.5 Global Assets Media Cache


Hi All,

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.

<location path="globalassets">
    <staticFile expirationTime="365.0:0:0" />

Does anyone else know how this should be configured? Any help would be super appreciated!


Dec 08, 2016 15:58

That should do it but a sugestion is to remove the types of images as well in the static content section:

 <!-- Image types -->
  <remove fileExtension=".jpg"/>
  <mimeMap fileExtension=".jpg" mimeType="image/jpeg"/>
  <remove fileExtension=".png"/>
  <mimeMap fileExtension=".png" mimeType="image/png"/>

Have you register this as well:

    <section name="staticFile" type="EPiServer.Framework.Configuration.StaticFileSection" />
  <staticFile expirationTime="365.0:0:0"/>
Dec 08, 2016 16:54

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
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Frame-Options: SAMEORIGIN
Date: Fri, 09 Dec 2016 10:03:09 GMT
Content-Length: 17418


Dec 09, 2016 11:26
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.