header.filter_except

VOIDheader.filter_exceptIDwhereSTRINGheaders

Available inall subroutines.

Removes all headers from the provided request, response, or cached object variable, except for protected headers and those listed as parameters. This function call is equivalent to using the unset statement or the header.unset function for every header except those listed as parameters. Header names are not case sensitive.

Note that unlike querystring.filter_except(), header names are passed as individual arguments rather than a single string with header names separated by an equivalent to querystring.filtersep.

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.filter_except is called.

The headers arguments is a list of zero or more names of headers that will be kept on the provided where variable. Header names are ignored when they are not present on the provided where variable.

Some headers are protected. These headers cannot be modified, and are unaffected by header.filter_except. See the Header reference for which headers are protected.

Calling header.filter_except with the empty string, a not-set value, or a string that would be invalid as a header name, is not permitted by the compiler.

Example

The following example will remove all headers from the client request except for the headers Accept, User-Agent, Accept-Encoding, and any protected headers.

header.filter_except(req, "Accept", "User-Agent", "Accept-Encoding");