I’m actually having a lot of problem trying to get Varnish Cache to work. I’m trying to accomplishing caching of pages when there’s a presence of a language cookie but X-Cache is always missing.
So far I have only gotten it to work only when when a new user comes to the page with no existing cookies such as doing a repeated (curl -I URL). Only in this case, X-Cache will hit.
But if there is an existing cookie from a returning user (a language cookie is needed so as to serve the correct language content to the returning user, meaning each URL has a few different versions and the respective version for each language is served based on the cookie) - In this case, X-Cache is always missing.
So how do I vary page caches (to have cache versions) with the same URL and different cookie value (language) or how to separately cache pages based on value of a specific cookie?
Below are the headers when I do an curl -I
HTTP/1.1 200 OK
Set-Cookie: WebSiteLang=fr; expires=Sun, 05-Jun-2016 08:42:24 GMT; Max-Age=31536000
Date: Sat, 06 Jun 2015 08:42:24 GMT
Via: 1.1 varnish