The reason for this is a very stupid law implemented in the European Union that is supposed to protect people from… well, actually, it doesn’t protect anyone from anything. Okay, technically, it protects you from your sanity.
Especially if you use Google Adsense to put ads on your web site, you probably have received an e-mail from them telling you that you must have a Cookie Consent thingie on your site by the end of September 2015 in order to comply with yet another EU cookie law.
Right, so, how do you add cookie consent to your site – quickly and easily?
So, you optimize your app, and implement some caching. It’s faster, but not fast enough.
So, you decide to use Varnish, the popular reverse-proxy web application accelerator. It doesn’t work.
Well, client-side cookies are for the JS on your site; your application doesn’t actually care about them. BUT – and this is an annoying “but” – if those client-side cookies are set for “yourdomain.com”, then with every single request a reader makes to your server, those cookies are sent along.
And that means Varnish won’t cache anything, because it says, “Cookies?! EEK! No caching!”
So, how do you make Varnish happy with only the cookies that you want to keep?