【问题标题】:Why can't Varnish Cache cache .woff files?为什么 Varnish Cache 不能缓存 .woff 文件?
【发布时间】:2016-07-20 23:55:16
【问题描述】:

我有一个 .woff 文件,无论我的 VCL 配置如何,Varnish 都会对其进行点击。这种文件类型有什么东西会阻止它被缓存吗?

我正在使用 Varnish 4.1.3、Ubuntu 14.04.2 LTS 和 Apache 2.4.7。

【问题讨论】:

  • Varnish 默认缓存取决于后端指定的缓存能力。

标签: apache varnish varnish-4


【解决方案1】:

您必须让 Apache 为 Varnish 发送正确的 Expires 标头来缓存这些字体文件。更改您的 Apache 配置/.htaccess:

  1. 为字体文件添加适当的 MIME 类型:

    AddType application/font-woff woff

  2. 指定您希望 Varnish 缓存这些的最大过期时间:

    ExpiresByType application/font-woff "access plus 1 month"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-22
    • 1970-01-01
    • 2018-09-20
    • 1970-01-01
    • 2012-03-09
    • 2014-02-13
    • 1970-01-01
    相关资源
    最近更新 更多