Varnish Caching based on Cookie

Thomas Lecomte thomas.lecomte at
Fri Nov 25 10:26:15 CET 2016

On Fri, Nov 25, 2016 at 10:12 AM, Thijs Cramer <t.cramer at> wrote:
> I'm asking because we segment users into 20 segments by using a cookie,
> but we don't want to increase our page cache 20-fold.


If you add a cookie to the hash, and this cookie can have 20 different
values, then you could end up with up to 20 differents objects in
cache. Varnish doesn't look into the content of the object and won't
"de-duplicate" objects or their content.

Also, beware of adding user data (cookie value, set by the client's
browser) into objects' hashes, as it could enable a client to saturate
the cache by filling it until exhaustion.

  Thomas Lecomte  /       Sysadmin
+33 4 86 13 48 65 / Virtual Expo, Marseille

More information about the varnish-misc mailing list