---
title: header.filter
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/headers/header-filter
---

```
VOID header.filter(ID where, STRING headers...)
```

**Available in:** all subroutines

Removes all headers listed as parameters from the provided request, response,
or cached object variable, except for protected headers. This function call is
equivalent to using the `unset` statement or the `header.unset()` function for
every header listed as a parameter. Header names are case insensitive.

Note that unlike
[querystring.filter()](https://www.fastly.com/documentation/reference/vcl/functions/query-string/querystring-filter/),
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](https://www.fastly.com/documentation/reference/vcl/variables/) of the same
name. The predefined variable associated with the _where_ argument must be
writable within the VCL subroutine where `header.filter()` is called.

The _headers_ arguments is a list of zero or more names of headers that will be
removed from 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()`.
See the [Header reference](https://www.fastly.com/documentation/reference/http/http-headers/)
for which headers are protected.

Calling `header.filter()` 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 the "Server", "X-Powered-By", and
"Content-MD5" headers from the client response object.

```vcl
header.filter(resp, "Server", "X-Powered-By", "Content-MD5");
```
