IIS 7.5 and images not being cached

六眼飞鱼酱① 提交于 2019-11-29 22:26:06

The following should cause the browsers to cache your images:

<staticContent>
    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
<httpProtocol>
    <customHeaders>
        <add name="Cache-Control" value="public" />
    </customHeaders>
</httpProtocol>

The <caching>...</caching> block is for server-side caching, not client side caching.

In case anyone needs to configure your site as Chrome Audits or GTMetrix require I've configured my environments with the following (thanks to Marco's answer):

<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />

using 365 days and both tools took that value as acceptable for a cache time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!