JK.*_*JK. 6 asp.net-mvc https caching browser-cache iis-7.5
在IIS 7.5中,我将cacheControlMaxAge设置为一年
<location path="Content/Images">
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
</system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)
根据本指南:设置Expires和Cache-Control:ASP.NET中静态资源的max-age标头
但是,Google PageSpeed工具仍然说文件没有缓存:
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
* https://local.example.com/Content/Images/image1.png (expiration not specified)
(etc)
Run Code Online (Sandbox Code Playgroud)
为什么说"未指定过期"?
整个webapp都通过https提供,这是一个因素吗?
我通过将指定的路径更改Content/Images为just 来解决这个问题Content
<location path="Content">
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public"
cacheControlMode="UseMaxAge"
cacheControlMaxAge="365.00:00:00" />
</staticContent>
</system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)
所以它是固定的,但路径的改变并不能说明实际问题是什么.