如何在IIS中的静态资源的HTTP标头中设置到期日期或最长期限 [英] How do you set the expiry date or a maximum age in the HTTP headers for static resources in IIS
问题描述
我使用 IIS 6 和 IIS 7 作为网络服务器。
I am using IIS 6 and IIS 7 as a web server.
运行后谷歌网页速度在线,它评论我应该:在静态资源的HTTP标头中设置到期日期或最长期限指示浏览器从本地磁盘加载以前下载的资源而不是通过网络。
After running Google page speed online , it remarks that I should be: 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.
它列出了很多普通的图像,我的 javascript文件和样式表。
And it lists a lot of plain images , my javascript files and the style sheets.
我如何为这些静态文件设置此到期日期?我认为这是由浏览器自动完成的?
How can I set this expiry date for these static files ? I thought this was done automatically by the browser ?
推荐答案
利用浏览器缓存:
在静态
资源的HTTP标头中设置到期日期或最大
年龄指示浏览器加载
之前从本地磁盘下载资源
而不是
网络。
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标头中设置到期日期或最长期限
To set an expiry date or a maximum age in the HTTP headers for static resources
打开IIS管理器 - >单击您的站点 - >单击主页中的HTTP响应标题 - >单击动作面板上的设置公共标题 - >检查过期Web内容 - >设置7天后(按照页面中的建议)速度分析具体说明y以后资源的未来至少一周到期
Open IIS manager-> Click your site-> Click the HTTP Response Headers in the home page-> Click the Set Common Headers on the Actions panel -> Check Expire Web Content -> Set After 7 days (as suggested for in the page speed analysis "Specify an expiration at least one week in the future for the following resources"
http://technet.microsoft.com/en-us/library/cc770661%28WS.10%29.aspx
这篇关于如何在IIS中的静态资源的HTTP标头中设置到期日期或最长期限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!