【发布时间】:2016-07-20 23:55:16
【问题描述】:
我有一个 .woff 文件,无论我的 VCL 配置如何,Varnish 都会对其进行点击。这种文件类型有什么东西会阻止它被缓存吗?
我正在使用 Varnish 4.1.3、Ubuntu 14.04.2 LTS 和 Apache 2.4.7。
【问题讨论】:
-
Varnish 默认缓存取决于后端指定的缓存能力。
我有一个 .woff 文件,无论我的 VCL 配置如何,Varnish 都会对其进行点击。这种文件类型有什么东西会阻止它被缓存吗?
我正在使用 Varnish 4.1.3、Ubuntu 14.04.2 LTS 和 Apache 2.4.7。
【问题讨论】:
您必须让 Apache 为 Varnish 发送正确的 Expires 标头来缓存这些字体文件。更改您的 Apache 配置/.htaccess:
为字体文件添加适当的 MIME 类型:
AddType application/font-woff woff
指定您希望 Varnish 缓存这些的最大过期时间:
ExpiresByType application/font-woff "access plus 1 month"
【讨论】: