.htaccess RequireJS不会像预期的那样缓存所有文件,它只缓存部分文件(请参阅我的htaccess文件)

.htaccess RequireJS不会像预期的那样缓存所有文件,它只缓存部分文件(请参阅我的htaccess文件),.htaccess,caching,requirejs,.htaccess,Caching,Requirejs,我的htaccess文件 <IfModule mod_expires.c> # Activate mod_expires for this directory ExpiresActive on #HTML documents are good for a week from the time they were changed ExpiresDefault M604800 </IfModule> <IfModule mod_expires.c> Exp

我的htaccess文件

<IfModule mod_expires.c>
# Activate mod_expires for this directory
ExpiresActive on
#HTML documents are good for a week from the time they were changed
ExpiresDefault M604800 
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"
</IfModule>

<IfModule mod_headers.c>
    # WEEK
    <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
        Header set Cache-Control "max-age=604800, public"
    </FilesMatch>

    # WEEK
    <FilesMatch "\.(js|css|swf)$">
        Header set Cache-Control "max-age=604800"
    </FilesMatch>
</IfModule>

#激活此目录的mod_过期
过期于
#HTML文档在更改后的一周内有效
到期默认值M604800
过期于
ExpiresByType文本/css“访问加1年”
ExpiresByType应用程序/javascript“访问加1年”
#周
标题集缓存控制“最大年龄=604800,公共”
#周
标题集缓存控制“最大年龄=604800”
响应和请求头

实际缓存的js文件中缺少此
max age=0


有人知道我错过了什么?

多亏了你,我才明白

这是一个chrome问题,当您实际按CTRL+R刷新页面时,chrome将发送一些最大年龄为0的请求标题,以及当您点击enter进入url时。看起来有点随意。但不会对正常的用户体验造成太大影响