我想为IIS8.5上的google字体指定一个缓存验证器。
http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,300,700,600我在web.config上做的事情如下所示;
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
</staticContent>我还通过扩展添加了缓存
<caching>
<profiles>
<add extension=".woff" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
<add extension=".ttf" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
<add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
<add extension=".js" policy="CacheForTimePeriod" kernelCachePolicy="CacheUntilChange" duration="23:59:00" />
<add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
<add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="23:59:00" />
<add extension=".css" policy="CacheForTimePeriod" kernelCachePolicy="CacheUntilChange" duration="23:59:00" />
</profiles>
</caching>但是我仍然不能为我使用的Google字体应用缓存验证器。我也尝试将静态内容的过期时间设置为2030年5月,但谷歌PageSpeed也没有意识到这一点。*我已经设法用.httaccess做到了这一点,并检查了堆栈溢出上的.htaccess主题。*
发布于 2015-09-10 18:02:22
您只能将缓存验证器应用于服务器不包含外部内容的内容;-)。此外,这是一个误报,因为Google字体有缓存控制指令:
https://redbot.org/?uri=http%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DOpen%2BSans%3A400%2C800
https://stackoverflow.com/questions/28925452
复制相似问题