header.get

STRINGheader.getIDwhereSTRINGheader_name

Available inall subroutines.

Gets a header value by name. This is equivalent to reading the req.http.xyz style variables 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, corresponding to the predefined variable of the same name. The predefined variable associated with the where argument must be writable within the VCL subroutine where header.get is called.

set resp.http.xyz = header.get(req, "user-agent");

is equivalent to:

set resp.http.xyz = req.http.user-agent;

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

Calling header.get 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, causes header.get to return a not-set value.

See header.set for valid characters in header names.