How to configure Etags in Sitecore?
Asked Answered
H

1

5

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

Hammock answered 16/6, 2016 at 15:32 Comment(0)
D
8

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>
Dipteran answered 20/6, 2016 at 21:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.