Typo3 8.5 - 启用 client-side 缓存

Typo3 8.5 - Enable client-side caching

我正在尝试在由 Typo3 8.5.3 提供支持的我的网站上启用 client-side 缓存。

我找到了这个页面: https://typo3.org/documentation/article/using-cache-control-headers-in-typo3/

但我无法让它发挥作用。

这些是我的设置,我是不是遗漏了什么?

config {
   no_cache = 0
   sendCacheHeaders = 1
   cache_period = 86400
   cache_clearAtMidnight = 1
}

我已将其包含在我网站的模板使用中,但它似乎不起作用。不知道是服务器配置问题还是Typo3配置问题

我想启用 client-side 缓存以满足 google 对他 "speed test" 的建议:https://developers.google.com/speed/pagespeed/insights/

这是一个当前的 header 我得到一个 js 文件 :

Date    Mon, 25 Sep 2017 14:01:18 GMT
Server    Apache
Last-Modified     Mon, 17 Jul 2017 07:13:51 GMT
ETag         "224cf4-20976e-5547e24169863"
Accept-Ranges       bytes
Content-Length      2135918
Content-Security-Policy     default-src * ; style-src * 'u…'unsafe-inline' 'unsafe-eval'
X-WebKit-CSP       default-src *; style-src * 'un…'unsafe-inline' 'unsafe-eval'
Content-Type      text/javascript
Strict-Transport-Security       max-age=31536000
X-XSS-Protection       1; mode=block
X-Content-Type-Options      nosniff

您可以通过将以下配置添加到您的 .htaccess 来控制过期日期(您可能需要 add/remove 一些配置来匹配您的确切条件,但模式应该清晰):

ExpiresActive On
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/svg+xml "access plus 1 week"
ExpiresByType text/css "access plus 1 week"

这确实将给定文件 mime 类型的过期时间设置为 1 周。如前所述,您可能必须调整控制哪些文件 mimetypes 才能消除所有警告。