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
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 https://github.com/bjuris/EPiServer.CdnSupport to your site also to add some uniqueness to the media URLs.
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;
I then found that the E-Tag and the Expires headers were correctly set on the blobs, and PageSpeed was happy enough with it.