To achieve better performance of website, I have browsed some of the web sites and observed that by updating following settings in Sitecore.config we will achieve this.

By doing following changes, will there any effect in website, effect means: even after uploading new images, old images will display on website from cache like that?

Please help in this..

  1. <setting name="DisableBrowserCaching" value="false"/> <!-- Initially it will be true -->

  2. <setting name="MediaResponse.Cacheability" value="public"/> <!-- Initially it will be private -->

  3. Adding Etags in web.config


    <remove name="cacheControlHeader" />
      <add name="ETag" value="&quot;&quot;" />

2 Answers 2


To ensure that new images are served, and not old ones from cache, you "cache bust" the images to include a revision parameter.

Create a new class, inheriting from the old one and append the revision or the modified date:

using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Resources.Media;

namespace MyProject.CMS.Custom.Media
    public class MediaProvider: Sitecore.Resources.Media.MediaProvider
        public override string GetMediaUrl(MediaItem item)
            Assert.ArgumentNotNull((object)item, "item");
            return this.GetMediaUrl(item, MediaUrlOptions.Empty);

        public override string GetMediaUrl(MediaItem item, MediaUrlOptions options)
            Assert.ArgumentNotNull((object) item, "item");
            Assert.ArgumentNotNull((object) options, "options");

            string mediaURL = base.GetMediaUrl(item, options);

            mediaURL = Sitecore.Web.WebUtil.AddQueryString(mediaURL, new string[] {"revision", ((Item)item).Statistics.Revision });
            mediaURL = Sitecore.Web.WebUtil.AddQueryString(mediaURL, new string[] {"modified", ((Item)item).Statistics.Updated.ToString("yyyyMMddHHmmss") });

            return mediaURL;

Update the config to point to your new class.

    <patch:attribute name="type">MyProject.CMS.Custom.Media.MediaProvider, MyProject.CMS.Custom</patch:attribute>

As @Gatogordo mentions in his answer, you should leave DisableBrowserCaching=true especially if you have dynamic pages which should always be served from the server. Make sure you have the cache settings configured on the controls in Sitecore so server side caching is optimal.

The MediaResponse.Cacheability will depend on whether you are using any content delivery networks, but generally public is a fairly safe configuration for optimal caching downstream. Combined with the code above, any updates to media should be reflected to the user without any issues.


Your question about DisableBrowserCaching has a very good answer here: What does the DisableBrowserCaching setting actually disable?. As you will read there, some effects might occur, depending on how your site is setup. Personally, I would not recommend this unless your site is very static (but then, why did you spend money on Sitecore?).

The MediaResponse setting is explained here. This one will only affect your images and can be altered. Your new images will still appear, old images will come from cache, .. There could be an issue if you "alter" an image (meaning: change an image without altering the name). As your url doesn't change, your cache will not know the image was changed. But I don't think many editors actually do that.. the will mostly create new images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.