Upgrading to Varnish 5.0
Changes to VCL#
-
All VCL Objects should now be defined before used
-
in particular, this is now required for ACLs. The error message for ACLs being used before being defined is confusing - see PR #2021:
Name <acl> is a reserved name
-
-
VCL names are restricted to alphanumeric characters, dashes (-) and underscores (). In addition, the first character should be alphabetic. That is, the name should match “[A-Za-z][A-Za-z0-9 -]*”.
- Like strings, backends and integers can now be used as boolean expressions in if statements. See
vcl(7)for details. -
Add support to perform matches in assignments, obtaining a boolean as result:
set req.http.foo = req.http.bar ~ "bar"; -
Returned values from functions and methods’ calls can be thrown away.
backends#
- Added support for the PROXY protocol via
.proxy_headerattribute. Possible values are 1 and 2, corresponding to the PROXY protocol version 1 and 2, respectively.
vcl_recv#
- Added
return (vcl(label))to switch to the VCL labelled label. - The
rollbackfunction has been retired.
vcl_hit#
- Replace
return (fetch)withreturn (miss).
vcl_backend_*#
- Added read access to
remote.ip,client.ip,local.ipandserver.ip.
vcl_backend_fetch#
- Added write access to
bereq.body, the request body. Onlyunsetis supported at this time. - We now send request bodies by default (see Request Body sent always / “cacheable POST”). To keep the previous behaviour add the following code before any
return (..)statement in this subroutine:if (bereq.method == "GET") { unset bereq.body; }
vcl_backend_error#
- Added write access to
beresp.body, the response body. This may replacesynthetic()in future releases.
vcl_deliver#
- Added read access to
obj.ttl,obj.age,obj.graceandobj.keep.
vcl_synth#
- Added write access to
resp.body, the response body. This may replacesynthetic()in future releases.
Management interface#
- To disable CLI authentication use
-S none. n_waitingliststatistic removed.
Changes to parameters#
- Added
ban_lurker_holdoff. - Removed
session_max. This parameter actually had no effect since 4.0 but might come back in a future release. vcl_pathis now a colon-separated list of directories, replacingvcl_dir.vmod_pathis now a colon-separated list of directories, replacingvmod_dir.
Other changes#
varnishstat(1)-f option accepts aglob(7)pattern.- Cache-Control and Expires headers for uncacheable requests (i.e. passes) will not be parsed. As a result, the RFC variant of the TTL VSL tag is no longer logged.
