return
Available inall subroutines.
Terminates a subroutine and sets the return state.
return(lookup);
The return states available vary by subroutine. return
can also be used to terminate custom subroutines and pass control back to the parent if used without a parameter. For example, the following code will set the header custom_header
to "Hello big world":
sub my_custom_sub { set req.http.custom_header += "big "; return; set req.http.custom_header += "wide "; # Does not run}
sub vcl_recv { set req.http.custom_header = "Hello "; call my_custom_sub; set req.http.custom_header = "world."; # Runs because the `return` statement in my_custom_sub did not specify a return state}