Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Etags in Sitecore?

Could you someone have experience configuring Etags in Sitecore 8.1? I do not see all images coming from Media library has response cache header ETag.

I have verified in Most modern browsers chrome and Firefox Network Tab.

Thanks Mala

like image 836
Mala Mohan Avatar asked Jun 16 '16 15:06

Mala Mohan


1 Answers

Change the MediaResponse.Cacheability setting in App_Config\Sitecore.config to Public:

<setting name="MediaResponse.Cacheability" value="Public" />

Once the setting is changed, the result as shown in Fiddler:

enter image description here

FYI, other settings are:

  • NoCache: nobody can cache the page.
  • Private: only browsers can cache. it (but not shared proxies). This is the default value.
  • Public: everybody can cache the page, proxies included.
  • Server: pages are cached only on the server (like the NoCache, so browsers don't cache the page).
  • ServerAndNoCache: Server and NoCache... the same as Server.
  • ServerAndPrivate: Server and Private... the same as Private.

NOTE: To follow Sitecore's Best Practice, instead of changing direct changes to Ssitecore configs, create the following patch file (MediaResponseCacheabilityPublic.config) in \App_Config\Include\zzz\ folder:

   <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" >
      <sitecore>
        <settings>
          <setting name="MediaResponse.Cacheability" set:value="Public" />
        </settings>
      </sitecore>
    </configuration>
like image 162
Konstantin Avatar answered Sep 30 '22 13:09

Konstantin