I have a fresh install of Slackware 64 14bit, and looking through Varnish installation documentation I have all the dependencies installed and compiled varnish with no error (make check
passes all tests)
Yet, when I try to run varnish using
varnishd -f /etc/varnish/user.vcl -s malloc,4G -T 127.0.0.1:2000
I get
Message from VCC-compiler:
Unknown variable 'req.grace'
At: ('input' Line 17 Pos 9)
set req.grace = 15s;
--------#########-------
Running VCC-compiler failed, exit 1
VCL compilation failed
My very simple /etc/varnish/ucer.vcl
file looks like this:
vcl 4.0;
# set default backend if no server cluster specified
backend default {
.host = "127.0.0.1";
.port = "8080";
.probe = {
.url = "/";
.timeout = 34ms;
.interval = 1s;
.window = 10;
.threshold = 8;
}
}
sub vcl_recv {
set req.grace = 15s;
}
sub vcl_fetch {
set beresp.grace = 30m;
}
The variable names are identical to this example.
varnishd -V
returns
varnishd (varnish-4.0.0 revision 2acedeb)
By removing both sub vcl_recv and sub vcl_fetch (using only backend default) varnish works fine and I can see it's headers, but I need to edit the VCL file.
Any ideas?
You are using Varnish 4.0.0, which needs updating from the 3.0 format your VCL code is based on.
req.grace is gone (you usually don't need it) and vcl_fetch is now called vcl_backend_response.
See the upgrade documentation: https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html