1VMOD_HEADER(3)                                                  VMOD_HEADER(3)
2
3
4

NAME

6       vmod_header - Header VMOD for Varnish
7

SYNOPSIS

9          import header [from "path"] ;
10
11          VOID append(HEADER, STRING)
12
13          VOID copy(HEADER, HEADER)
14
15          STRING get(HEADER header, STRING regex)
16
17          VOID remove(HEADER header, STRING regex)
18

DESCRIPTION

20       Varnish  Module  for  manipulation  of  duplicated  HTTP  headers,  for
21       instance multiple Set-Cookie headers.
22
23       Example:
24
25          vcl 4.0;
26          import header;
27
28          backend default { .host = "192.0.2.11"; .port = "8080"; }
29
30          sub vcl_backend_response {
31              if (beresp.http.Set-Cookie) {
32                  # Add another line of Set-Cookie in the response.
33                  header.append(beresp.http.Set-Cookie, "VSESS=abbabeef");
34
35                  # CMS always set this, but doesn't really need it.
36                  header.remove(beresp.http.Set-Cookie, "JSESSIONID=");
37              }
38          }
39
40   VOID append(HEADER, STRING)
41       Description
42              Append an extra occurrence to an existing header.
43
44       Example
45              :: header.append(beresp.http.Set-Cookie, "foo=bar")
46
47   VOID copy(HEADER, HEADER)
48       Description
49              Copy all source headers to a new header.
50
51       Example
52              ::                           header.copy(beresp.http.set-cookie,
53              beresp.http.x-old-cookie);
54
55   STRING get(HEADER header, STRING regex)
56       Description
57              Fetches  the  value  of  the first header that matches the given
58              regular expression regex.
59
60       Example
61              ::              set              beresp.http.xusr              =
62              header.get(beresp.http.set-cookie,"user=");
63
64   VOID remove(HEADER header, STRING regex)
65       Description
66              Remove all occurences of header that matches regex.
67
68       Example
69              :: header.remove(beresp.http.set-cookie,"^(?!(funcookie=))");
70

ACKNOWLEDGEMENTS

72       The  development of this plugin was made possible by the sponsorship of
73       Softonic, http://en.softonic.com/ .
74
75       Also thanks to Imo Klabun and Anders Nordby for bug reports.
76

BUGS

78       You can't use dynamic regular expressions, which also  holds  true  for
79       normal regular expressions in regsub().
80
81
82
83
84                                                                VMOD_HEADER(3)
Impressum