Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (33 sloc) 1.25 KB

vmod-zlib

https://travis-ci.org/thomsonreuters/libvmod-zlib.svg?branch=master

SYNOPSIS

import zlib;

DESCRIPTION

ZLIB vmodule for Varnish 4 and 5. libvmod-zlib uncompress request's body before sending it to the backend. E.g. it is useful when backends doesn't support compression. Also, It could be used to reduce backend's CPU load but note that it will impact network bandwidth and delay. Use it only for particular use-cases.

FUNCTIONS

unzip_request()

Uncompress the request's body in vcl_recv when Content-Encoding is set to gzip. No operation if Content-Encoding is unset or none.

USAGE

In your VCL you could then use this vmod along the following lines:

import zlib;

sub vcl_recv {
        if (zlib.unzip_request() < 0) {
            return (synth(400, "can't uncompress request's body"));
        }
}

Note that VMOD allocates the size of gzip_buffer bytes in the workspace_client. In order to work properly, you must increase the default size of workspace_client which is too low by default. (gzip_buffer and http_req_size are already taking the full space).