mod_expires没有在JPEG图像上设置缓存控制头

Mar*_*cel 6 apache .htaccess apache2 mod-expires http-headers

我无法弄清楚为什么< 10 KB我正在处理的网站中的普通旧JPEG图像(大约十几个)不会采用缓存控制标头,而是强制输入..htaccess我正在使用的规则基于最新的HTML5 Boilerplate .htaccess文件(下面的相关部分).有什么奇怪的是,网站中有大量相同数量的PNG,除了其中两个外,缓存控制标头工作正常.

<IfModule mod_expires.c>
  ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault                          "access plus 1 month"

...

# media: images, video, audio
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpg                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"

...

  <IfModule mod_headers.c>
    Header append Cache-Control "public"
  </IfModule>

</IfModule>
Run Code Online (Sandbox Code Playgroud)

(省略号表示ExpiresByType删除了多余的规则部分)

我已经从我的/etc/apache2/apache2.conf文件直接到那里包含的几乎所有conf文件,并且找不到合理的解释.我已经摆弄,Pagesped和Chrome审核了几个小时的死亡,我仍然无能为力.

编辑:如下所述,.htaccess此网站的Web根目录中只有一个文件.JPEG正在通过mime类型image/jpeg正常,但缓存控制标头丢失,我无法弄清楚为什么.

Mar*_*cel 5

我添加no-transform到该mod_headers部分,果然,它都按预期工作.现在我可以让我的额头从墙上休息一下.

  <IfModule mod_headers.c>
    Header append Cache-Control "public, no-transform"
  </IfModule>
Run Code Online (Sandbox Code Playgroud)