Scroll to navigation

VMOD_HEADER(3) VMOD_HEADER(3)

NAME

vmod_header - Header VMOD for Varnish

SYNOPSIS

import header [from "path"] ;

DESCRIPTION

Varnish Module (vmod) for manipulation of duplicated HTTP headers, for instance multiple Set-Cookie headers.

CONTENTS

  • func_append
  • func_copy
  • func_get
  • func_remove

append

VOID append(HEADER, STRING)


Description
Append an extra occurrence to an existing header.
Example

header.append(beresp.http.Set-Cookie, "foo=bar")



copy

VOID copy(HEADER, HEADER)


Description
Copy all source headers to a new header.
Example

header.copy(beresp.http.set-cookie, beresp.http.x-old-cookie);



get

STRING get(PRIV_CALL, HEADER header, STRING regex)


Description
Fetches the value of the first header that matches the given regular expression regex.
Example

set beresp.http.xusr = header.get(beresp.http.set-cookie,"user=");



remove

VOID remove(PRIV_CALL, HEADER header, STRING regex)


Description
Remove all occurences of header that matches regex.
Example

header.remove(beresp.http.set-cookie,"^(?!(funcookie=))");



ACKNOWLEDGEMENTS

The development of this plugin was made possible by the sponsorship of Softonic, http://en.softonic.com/ .

Also thanks to Imo Klabun and Anders Nordby for bug reports.

BUGS

You can't use dynamic regular expressions, which also holds true for normal regular expressions in regsub().