Symbol not found: 'bereq.is_bgfetch' (expected type BOOL)

33 Views Asked by At

I am certainly doing something wrong or I am missing something because it is driving me crazy.

I am using Varnish 6

in defautl.vcl, I am trying to not cache 5xx errors and preserve the existing cache

sub vcl_backend_response {
...
    if (beresp.status >= 500) {
        if (bereq.is_bgfetch) {
            return (abandon);
        }
        set beresp.uncacheable = true;
    }
...

}

and I got Symbol not found: 'bereq.is_bgfetch' (expected type BOOL) when I try to restart varnish

Should I set is_bgfetch somewhere or is is_bgfetch deprecated and there is another way to do the above ?

1

There are 1 best solutions below

1
Thijs Feryn On

Based on the comments we can conclude that you're using a deprecated version of Varnish that doesn't support bereq.is_bgfetch yet.

I would urge you to upgrade your Varnish installation to a recent & supported version.

Please have a look at https://www.varnish-software.com/developers/quick-start/, which describes how to easily install the LTS version of Varnish using packages.

If you want to latest fresh version of Varnish instead of the LTS version, please have a look at the packages on https://packagecloud.io/varnishcache/varnish74

Once you've upgrade to 6.0 LTS or 7.4 (which is currently the latest fresh version), you should have access to bereq.is_bgfetch.