Available inall subroutines.

Deletes a header by name. This is equivalent to the unset statement except that the header name is given as a string, and may be passed dynamically. Header names are case insensitive.

The where argument is one of the literal identifiers req, resp, obj, bereq, or beresp.

header.unset(req, "user-agent");

is equivalent to:

unset req.http.user-agent;

See also the unset statement, the client request, and other request and response variables.

Some headers are protected. These headers cannot be unset, and the header.unset function has no effect. See the Header reference for which headers are protected.

Calling header.unset for a header which does not exist, or passing the empty string, a not-set value, or a string that would be invalid as a header name, also has no effect.

See header.set for valid characters in header names.

User contributed notes


Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)