中易网

如何设置静态资源的"过期日期

答案:1  悬赏:80  
解决时间 2021-01-16 02:15
  • 提问者网友:爱了却不能说
  • 2021-01-15 13:33
如何设置静态资源的"过期日期
最佳答案
  • 二级知识专家网友:由着我着迷
  • 2021-01-15 14:15
在对一个网站做优化时,gtmetrix优化工具建议给在HTTP Header中为一些静态资源(几个js,css,jpg文件)设定一些长期的"过期日期",这样这些资源可以长期存在于客户端的浏览器缓存中,不用到服务器抓取。。。道理很清楚,但不知道怎么做,有人能帮忙一下吗?谢谢...
以下是建议:
Leverage browser caching
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.
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

•*****.js (expiration not specified)
•*****.jpg (expiration not specified)
•*****.jpg (expiration not specified)
•*****.css (expiration not specified)
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息