[Solved] Varnish Cache not caching? it's the Google Analytics cookie


If you see a long (> 0.5 or 1 s) Time To First Byte probably your html is not cached.

You can become sure about that by looking to the response header: Image%20121

This may happen because of Varnish Cookie Policy: «Varnish will, in the default configuration, not cache a object coming from the backend with a Set-Cookie header present. Also, if the client sends a Cookie header, Varnish will bypass the cache and go directly to the backend.

This can be overly conservative. A lot of sites use Google Analytics (GA) to analyze their traffic. GA sets a cookie to track you. This cookie is used by the client side javascript and is therefore of no interest to the server.»

I had this problem also with the frontend.

To solve it was enogh to go to: “APPLICATION SETTINGS” => “VARNISH SETTINGS”


The other image:


Are you saying we should exclude or include the _ga cookie in the Varnish settings?


To include it. I see no reason to avoid caching just because the user has the _ga cookie