Search code examples
varnishvarnish-vcl

Remove headers from vcl_deliver using regex


Is it possible to remove headers in vcl_deliver whose name matches a certain regular expression?

We throw headers called "X-env-blah" where "blah" could contain any value, and want them to be removed from the front-end.

Example (doesn't work):

unset resp.http.x-env$;

Or is there a way to loop through all the headers in vcl_deliver?

Thanks


Solution

  • VCL is a simple language that is converted into machine code when loaded.

    There are no loops nor any globbing.

    To do this you will either have to write a VMOD/inline-C, or just unset all possible headers each time.