Actions are used with the return(<action>)
keyword, which returns control from subroutines back to varnish. The action determines how processing in varnish continues as shown in Varnish Processing States.
Common actions are documented here, while additional actions specific to only one or some subroutines are documented in Built in subroutines as well as which action can be used from which built in subroutine.
fail
Transition to vcl_synth on the client side as for return(synth(503, "VCL Failed"))
, but with any request state changes undone as if std.rollback()
was called and forcing a connection close.
Intended for fatal errors, for which only minimal error handling is possible.
synth(status code, reason)
Transition to vcl_synth with resp.status
and resp.reason
being preset to the arguments of synth()
.
pass
Switch to pass mode, making the current request not use the cache and not putting its response into it. Control will eventually pass to vcl_pass.
pipe
Switch to pipe mode. Control will eventually pass to vcl_pipe.
restart
Restart the transaction. Increases the req.restarts
counter.
If the number of restarts is higher than the max_restarts parameter, control is passed to vcl_synth as for return(synth(503, "Too many restarts"))
For a restart, all modifications to req
attributes are preserved except for req.restarts
and req.xid
, which need to change by design.
abandon
Abandon the backend request. Unless the backend request was a background fetch, control is passed to vcl_synth on the client side with resp.status
preset to 503.
Copyright © 2006 Verdens Gang AS
Copyright © 2006–2020 Varnish Software AS
Licensed under the BSD-2-Clause License.
https://varnish-cache.org/docs/6.5/users-guide/vcl-actions.html