【问题标题】:Push http2 all css asset files using Varnish regex使用 Varnish regex 推送 http2 所有 css 资产文件
【发布时间】:2021-10-20 08:27:05
【问题描述】:

我正在使用 Varnish(快速)和 http2 来推送 cssjs 文件。我要推送所有cssjspng 文件。

我当前的配置只从给定路径推送指定的文件:

  if (fastly_info.is_h2 && req.url ~ "pl_PL")
  {
    h2.push("/bootstrap-theme/app.css");
    h2.push("/bootstrap-theme/app.js");
  }

是否可以配置 VCL 文件以便推送所有样式表、javascript 和图像?

我试图设置这样的东西,但没有运气。

  if (fastly_info.is_h2)
  {
    h2.push("\.(png|jpg|css|js)$");
  }

【问题讨论】:

    标签: varnish varnish-vcl fastly fastly-vcl


    【解决方案1】:

    这是不可能的。 但是他们不再推荐这种做法来推送资源: https://developer.fastly.com/reference/vcl/functions/tls-and-http/h2-push/

    【讨论】:

    • 经过更多研究,我得出了同样的结论。谢谢你的安慰
    猜你喜欢
    • 2018-04-05
    • 2020-02-23
    • 2017-12-13
    • 2018-09-06
    • 2020-01-07
    • 2018-03-06
    • 2019-01-04
    • 2019-02-25
    • 2018-05-25
    相关资源
    最近更新 更多