Available in all subroutines.
Unsets a variable or HTTP header.
unset fastly.error; # Predefined variableunset 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 solution recipes. Recipes apply VCL to real-world use cases and can be deployed as-is, or adapted for your own service. See the full list of recipesfor 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.
User contributed notes
We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.