unset

Available inall subroutines.

Unsets a variable or HTTP header.

unset fastly.error; # Predefined variable
unset resp.http.Expires; # HTTP header

While primarily used for removing HTTP headers from request or response objects, unset may also be used to clear some predefined variables (where indicated on the variable's reference page as "can be unset").

Try it out

unset is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Add, remove or change HTTP headers

Fastly can easily read and write HTTP headers at multiple stages of the request/response cycle.

Clean backend responses

Remove headers added by backends that you don't want to emit to the browser, like amz- or goog- headers.