Search code examples
reverse-proxyvarnishvarnish-vcl

How does Varnish 3.0 deal with gzip?


Varnish will hold compressed obj in Cache, but when client don't support gzip.

How does Varnish deal with it? Does it hold the other uncompressed obj in Cache too, or decompress the compressed obj?


Solution

  • Varnish 3.0 supports Gzip as mentioned in the "Compression" chapter of the official tutorial. All HTTP requests to the backend will include a request for gzipped content, so by default all objects are stored in memory gzipped.

    If the backend does not support gzip, you can ask Varnish to compress the response before storing it by setting beresp.do_gzip in vcl_fetch.

    If a request comes in from a client that does not support gzip, Varnish will gunzip the stored object before delivering it.