Hi,
Even when things are working as expected, it’s nice to be able to verify what’s going on, and really prove it. These response headers are excellent:
x-served-by: cache-den8252-DEN
x-cache: HIT
x-cache-hits: 1
Is it a MISS or HIT, and which cache.
Our web server is sending Response Headers that includes Vary: Cookie, origin.
That means the caching decision will be affected by Cookies, which makes sense.
On a certain set of pages, I’m stripping out the Cookies to cause more caching to take place.
unset req.http.Cookie:csrftoken;
Regardless of csrftoken, all users get the same cached content.
I would like to verify this. What comes to mind is another response header something approximately as follows:
x-cache-key: url,Cookie:sessionid
In other words
x-the-caching-decision-factors: full_url,Cookie:sessionid
When analyzing this particular result we would see that the cache decision was based on the URL, and maybe something unexpected, another cookie called “sessionid”. Since each user has a unique sessionid, we know that caching is very inefficient, and most likely each user will get x-cache: MISS
because they have a unique sessionid.
To mitigate the problem, remove that cookie too:
unset req.http.Cookie:sessionid;
Retry.
Now, without any sessionid cookie, it says:
x-cache-key: url
Perfect.
The question is, if there is a simple VCL recipe which could add this response header, and return an x-cache-key
value which has the above mentioned behavior. List each factor which affected the caching decision. More specific than just saying “Cookies”. Which cookies, for that particular cached webpage.
Thanks.