在Apache上的js,css和png资产上,浏览器Livarage缓存失败

时间:2018-08-17 07:27:08

标签: angular apache caching browser-cache

我正在尝试为我的angular5应用程序启用浏览器杠杆缓存。文件使用apache

这是我在vhost

中添加的配置
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresByType application/javascript  "access 1 week"
  ExpiresDefault "access 1 month"
</IfModule>
<IfModule mod_headers.c>
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
  Header set Cache-Control "max-age=2678400, public"
  </filesmatch>
  <filesmatch "\.(html|htm)$">
  Header set Cache-Control "max-age=7200, private, must-revalidate"
  </filesmatch>
  <filesmatch "\.(pdf)$">
  Header set Cache-Control "max-age=86400, public"
  </filesmatch>
  <filesmatch "\.(js)$">
  Header set Cache-Control "max-age=2678400, private"
  </filesmatch>
</IfModule>

但是我正在用https://tools.pingdom.com/测试我的网站,我收到.js ,.css and .png资产的缓存失败错误消息。

  

以下可缓存资源的生存期很短。   指定至少在未来一周内到期   以下资源:

0 个答案:

没有答案
相关问题