caching - 如何在 IIS 中设置静态资源的 HTTP header 中的到期日期或最长期限

标签 caching iis

我使用 IIS 6IIS 7 作为 Web 服务器。

运行Google page speed online后,它指出我应该:在静态资源的HTTP header 中设置到期日期或最长期限,指示浏览器加载以前下载的资源从本地磁盘而不是通过网络。

它列出了很多简单的图像、我的javascript文件样式表

如何为这些静态文件设置到期日期?我以为这是浏览器自动完成的?

最佳答案

利用浏览器缓存:

Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.

http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching

在静态资源的 HTTP header 中设置到期日期或最长期限

打开 IIS 管理器 -> 单击您的站点 -> 单击主页中的 HTTP 响应 header -> 单击操作面板上的设置通用 header -> 检查 Web 内容过期 -> 设置 7 天后(按照中的建议)页面速度分析“指定以下资源至少在未来一周内到期”

http://technet.microsoft.com/en-us/library/cc770661%28WS.10%29.aspx

关于caching - 如何在 IIS 中设置静态资源的 HTTP header 中的到期日期或最长期限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5562898/

相关文章:

database - 更新数据库后如何更新redis?

php - 如何将自定义行为添加到 symfony 缓存 :clear?

azure - 如何将 <clientCache/> 设置应用于 IIS 中的特定扩展?

asp.net-mvc - 什么是缓存配置文件?

caching - 让 nginx 仅根据文件名(而不是完整路径)缓存文件

c# - ASP.NET - 网站安装 list 中应包含哪些内容?

iis - IIS在Powershell中启用HTTP保持事件状态

excel - 冷融合11 : CFContent doesn't write openable excel file

ruby-on-rails - 在 Windows Server 上托管 Ruby 应用程序是否可行?

java - 缓存 URL 内容