varnishvarnish-vclfastlyfastly-vcl

Push http2 all CSS asset files using Varnish regex


I'm using Varnish (fastly) and http2 to push css and js files. I want to push all css, js, png files.

My current configuration pushes only specified files from a given path:

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

Is it possible to confiture VCL file so it will push all stylesheets, javascript and images?

I was trying to set up something like this but no luck.

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

Solution

  • It is not possible. However they do not recommend this practice anymore to push resources: https://developer.fastly.com/reference/vcl/functions/tls-and-http/h2-push/