HTTP标头(用于缓存控制)

时间:2018-05-27 09:49:42

标签: apache .htaccess cdn cloudflare

这句话是否正确?

  

css和js应该使用private进行代理缓存   https://developers.google.com/speed/docs/best-practices/caching#LeverageProxyCaching

我打算直接将它用于我的托管和alt。通过CDN,并希望获得最佳的速度优化设置, TTFB

<IfModule mod_headers.c>
Header set Connection keep-alive
<filesmatch "\.(ico|flv|gif|swf|eot|woff|otf|ttf|svg)$">
    Header set Cache-Control "max-age=2592000, public"
</filesmatch>
<filesmatch "\.(jpg|jpeg|png)$">
    Header set Cache-Control "max-age=1209600, public"
</filesmatch>
# css and js should use private for proxy caching https://developers.google.com/speed/docs/best-practices/caching#LeverageProxyCaching
<filesmatch "\.(css)$">
    Header set Cache-Control "max-age=31536000, private"
</filesmatch>
<filesmatch "\.(js)$">
    Header set Cache-Control "max-age=1209600, private"
</filesmatch>
<filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "max-age=600, private, must-revalidate"
  </filesMatch>

0 个答案:

没有答案