setcookie.delete_by_name
Available inall subroutines.
Deletes a Set-Cookie
header associated with the cookie_name
contained in
the HTTP response indicated by where
. The beresp
response is available in
the vcl_fetch
method, and the resp
response is available in the
vcl_deliver
method.
Returns true
if the Set-Cookie
header was deleted, and returns
false
otherwise. If fmt is prefixed with !
, returns true
if the header
was not deleted, and returns false
if it was.
If multiple cookies of the same cookie_name
are present in the response, then
all of them will be deleted.
When this function does not have enough memory to succeed, the request is failed.
This function conforms to RFC 6265.
Examples
# use the result to control the flow of executionsub vcl_fetch { set beresp.http.Set-Cookie = "foo=bar"; if (!setcookie.delete_by_name(beresp, "foo")) { // Do something if the Set-Cookie header associated with "foo" was not deleted }}
# ignore the resultsub vcl_deliver { declare local var.ignored BOOL; set resp.http.Set-Cookie = "bar=baz"; set var.ignored = setcookie.delete_by_name(resp, "bar"); # var.ignored is now true}