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

```
VOID header.unset(ID where, STRING header_name)
```

**Available in:** all 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`.

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

is equivalent to:

```vcl
unset req.http.user-agent;
```

See also the [unset statement](https://www.fastly.com/documentation/reference/vcl/statements/unset/),
the [client request](https://www.fastly.com/documentation/reference/vcl/variables/client-request/req-http/),
and other [request and response](https://www.fastly.com/documentation/reference/vcl/variables/) variables.

Some headers are _protected_. These headers cannot be unset,
and the `header.unset()` function has no effect.
See the [Header reference](https://www.fastly.com/documentation/reference/http/http-headers/)
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.
