Try our conversational search powered by Generative AI!

Leverage browser caching in Episerver for CMS admin images or site assets



I am checking my website performance speed at Google PageSpeed Insights

I am referring below url , and with the help of this I am able to cache my static images

but how can I cache image that are uploaded from CMS (that is siteassets).

Currently In my web.config file I have set



Aug 03, 2017 13:18

I recall reading that the staticFile-element might need to be put inside some <location>-elements as well.

When you set far future times it might be smart to add to your site also to add some uniqueness to the media URLs.

Aug 29, 2017 21:45

For anyone who has come accross this and is struggling to get any of the globalassets cached, I used the following code:

public class MediaHandler : BlobHttpHandler, IRenderTemplate<MediaData>
protected override Blob GetBlob(HttpContextBase httpContext)
var binary = ServiceLocator.Current.GetInstance<IContentRouteHelper>().Content as IBinaryStorable;
return binary?.BinaryData;

I then found that the E-Tag and the Expires headers were correctly set on the blobs, and PageSpeed was happy enough with it. 

Apr 20, 2018 10:47
* 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.