I have installed Magento 2.2.0-rc23 and now try to setup varnish FPC.
I generate VCL on BE System
-> Advanced
-> System
-> Full Page Cache
-> Varnish Configuration
-> Export VCL for Varnish 5
.
VCL was mounted to Varnish but during service start I getting the error:
Error:
Message from VCC-compiler:
Symbol not found: 's' (expected type DURATION):
('/etc/varnish/default.vcl' Line 203 Pos 23)
if (obj.ttl + s > 0s) {
----------------------#--------
Running VCC-compiler failed, exited with 2
VCL compilation failed
Full section
sub vcl_hit {
if (obj.ttl >= 0s) {
# Hit within TTL period
return (deliver);
}
if (std.healthy(req.backend_hint)) {
if (obj.ttl + s > 0s) {
# Hit after TTL expiration, but within grace period
set req.http.grace = "normal (healthy server)";
return (deliver);
} else {
# Hit after TTL and grace expiration
return (fetch);
}
} else {
# server is not healthy, retrieve from cache
set req.http.grace = "unlimited (unhealthy server)";
return (deliver);
}
}
Software:
- Varnish 5.1.3
- Magento 2.2.0-rc23
EDIT:
I look for other examples and when we add 0 to s varnish work properly
sub vcl_hit {
if (obj.ttl >= 0s) {
# Hit within TTL period
return (deliver);
}
if (std.healthy(req.backend_hint)) {
if (obj.ttl + 0s > 0s) {
# Hit after TTL expiration, but within grace period
set req.http.grace = "normal (healthy server)";
return (deliver);
} else {
# Hit after TTL and grace expiration
return (fetch);
}
} else {
# server is not healthy, retrieve from cache
set req.http.grace = "unlimited (unhealthy server)";
return (deliver);
}
}