If you are using Varnish and need to access headers which appear more than once (i.e. multiple set-cookie headers) then you'll have to install the vmod_header Varnish Module.

This is the initial install of Varnish 4.0

Note: You may have to configure the keys in the /etc/pki/rpm-gpg/ directory if you have issues accessing the repository

$ sudo su
$ rpm --nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.0.el6.rpm
$ yum install varnish

The cloning, configuration, compile and install of the Vanish Module

Note: it's necessary to checkout the master branch, as per this comment.

$ which git
$ history | grep -i yum
$ yum list | grep -i git
$ yum install git.x86_64
$ git status
$ git clone https://github.com/varnish/libvmod-header.git
$ cd libvmod-header/
$ git branch -a
$ git checkout master
$ git branch -a
$ yum list | grep -i automake
$ yum install automake libtool.x86_64
$ yum install python-docutils #(contains rst2man)
$ yum list installed varnish*
  Loaded plugins: dellsysid, fastestmirror
  Loading mirror speeds from cached hostfile
  * base: centos.serverspace.co.uk
  * epel: www.mirrorservice.org
  * extras: centos.hyve.com
  * updates: centos.hyve.com
 Installed Packages
  varnish.x86_64   4.0.3-3.el7   @epel
  varnish-libs.x86_64   4.0.3-3.el7   @epel
  varnish-libs-devel.x86_64   4.0.3-3.el7   @epe
$ ./autogen.sh
$ ./configure
$ make
$ make install
$ ll /usr/lib64/varnish/vmods
$ service varnish start

Usage

Once you have the module installed you'll able to obtain the values of headers which have multiple values for the same key via the header.get method - where the second parameter is a regular expression.

header.get(beresp.http.set-cookie,"nocache=")
Filed under: web, tools

comments

There are no comments.