#各大网站缓存配置策略

我列举了诸多网站资源进行测试:

  • github
  • medium
  • stackoverflow
  • 百度
  • 淘宝
  • 知乎
  • 掘金

以下是页面列表,见 https://github.com/shfshanyue/node-examples/blob/master/shell/page

https://juejin.cn
https://juejin.cn/post/7142699821919862815
https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web/app.ab9b18a.css
https://www.zhihu.com/question/36697792
https://zhuanlan.zhihu.com/p/377593512
https://static.zhihu.com/heifetz/main.lib_330004dc.99aece5edd9249563652.js
https://pica.zhimg.com/v2-9dffb51d1a85987a1b8655740d312933_l.jpg?source=172ae18b
https://devtool.tech
https://devtool.tech/_next/static/chunks/webpack-96cacc1f84598cec.js
https://www.bilibili.com/
https://www.bilibili.com/video/BV1MR4y1X7dC/
https://s1.hdslb.com/bfs/static/laputa-home/client/assets/vendor.aba2a2f0.js
https://s1.hdslb.com/bfs/static/jinkela/space/assets/icons.png
https://medium.com
https://cdn-client.medium.com/lite/static/js/1025.034ad363.js
https://github.com
https://github.com/shfshanyue/midash
https://avatars.githubusercontent.com/u/13389461
https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-5936f45973f5.js

对其逐个通过 curl 发送请求,并输出 cache-control/age 响应头,如下所示:

https://sf3-scmcdn2-cn.feishucdn.com/ccm/pc/web/resource/bear/js/87718.a31f7f1bcb5a4449b642.js
cache-control: max-age=31536000
age: 860031

https://juejin.cn

https://juejin.cn/post/7142699821919862815

https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web/app.ab9b18a.css
cache-control: max-age=31536000
age: 334217

https://www.zhihu.com/question/36697792
cache-control: private, must-revalidate, no-cache, no-store, max-age=0

https://zhuanlan.zhihu.com/p/377593512
cache-control: must-revalidate, proxy-revalidate, no-cache, no-store

https://static.zhihu.com/heifetz/main.lib_330004dc.99aece5edd9249563652.js
cache-control: max-age=31536000
age: 93

https://pica.zhimg.com/v2-9dffb51d1a85987a1b8655740d312933_l.jpg?source=172ae18b
cache-control: public, max-age=31536000

https://devtool.tech
age: 0
cache-control: private, no-cache, no-store, max-age=0, must-revalidate

https://devtool.tech/_next/static/chunks/webpack-96cacc1f84598cec.js
age: 95818
cache-control: public,max-age=31536000,immutable

https://www.bilibili.com/
cache-control: no-cache

https://www.bilibili.com/video/BV1MR4y1X7dC/

https://s1.hdslb.com/bfs/static/laputa-home/client/assets/vendor.aba2a2f0.js
cache-control: max-age=31536000
age: 0
access-control-allow-headers: Origin,No-Cache,X-Requested-With,If-Modified-Since,Pragma,Last-Modified,Cache-Control,Expires,Content-Type,Access-Control-Allow-Credentials,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Cache-Webcdn

https://s1.hdslb.com/bfs/static/jinkela/space/assets/icons.png
cache-control: max-age=31536000
age: 128638
access-control-allow-headers: Origin,No-Cache,X-Requested-With,If-Modified-Since,Pragma,Last-Modified,Cache-Control,Expires,Content-Type,Access-Control-Allow-Credentials,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Cache-Webcdn

https://medium.com
cache-control: no-cache, no-store, max-age=0, must-revalidate

https://cdn-client.medium.com/lite/static/js/1025.034ad363.js
age: 624671
cache-control: public, max-age=31536000

https://github.com
cache-control: max-age=0, private, must-revalidate

https://github.com/shfshanyue/midash
cache-control: max-age=0, private, must-revalidate

https://avatars.githubusercontent.com/u/13389461
cache-control: max-age=300

https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-5936f45973f5.js
cache-control: public, max-age=31536000
age: 527921