如何在Sitecore中配置Etags?

Mal*_*han 4 caching sitecore browser-cache etags

你有没有经验可以在Sitecore 8.1中配置Etags?我没有看到来自媒体库的所有图像都有响应缓存标头ETag.

我已经在大多数现代浏览器中验证了chrome和Firefox Network Tab.

谢谢马拉

小智 5

将App_Config\Sitecore.config中的MediaResponse.Cacheability设置更改为Public:

<setting name="MediaResponse.Cacheability" value="Public" />
Run Code Online (Sandbox Code Playgroud)

设置更改后,结果如Fiddler所示:

在此输入图像描述

仅供参考,其他设置如下:

  • NoCache:没有人可以缓存页面.私有:只有浏览器可以缓存它(但不是共享代理).这是默认值
  • 公共:每个人都可以缓存页面,包括代理
  • 服务器:页面仅缓存在服务器上(如NoCache,因此浏览器不缓存页面)
  • ServerAndNoCache:Server和NoCache ......与Server相同
  • ServerAndPrivate:Server和Private ...与Private相同

注意:要遵循Sitecore的最佳实践,而不是更改对Ssitecore配置的直接更改,请在'\ App_Config\Include\zzz \文件夹中创建以下修补程序文件(MediaResponseCacheabilityPublic.config):

   <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>
Run Code Online (Sandbox Code Playgroud)