Problem
I'm setting up Authcache to work with Varnish as a backend.
It comes with an excellent default.vcl which is very well documented. It has the following section on cookies. Varnish skips the cache if cookies are enabled, so the following example would appear to remove all cookies so it can cache.
However I've found if I un-comment this section Authcache stops caching. If I leave it commented out then it continues to cache and cookie functionality seems to work. (e.g. I have cookies which remember the state of facets across page refreshes and they continue to work).
Isn't this the wrong way around?
(I'm using Authcache debug to test for caching).
// * Example 2: Remove all but
// * - the session cookie (SESSxxx, SSESSxxx)
// * - the cache invalidation cookie for authcache p13n (aucp13n)
// * - the NO_CACHE cookie from the Bypass Advanced module
// * - the nocache cookie from authcache
// *
// * Note: Please also add the has_js cookie to the list if Authcache Ajax
// * is also enabled in the backend. Also if you have Authcache Debug enabled,
// * you should let through the aucdbg cookie.
// *
// * More information on:
// * https://www.varnish-cache.org/docs/3.0/tutorial/cookies.html
// */
//if (req.http.Cookie) {
// set req.http.Cookie = ";" + req.http.Cookie;
// set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
// set req.http.Cookie = regsuball(req.http.Cookie, ";(S?SESS[a-z0-9]+|aucp13n|NO_CACHE|nocache|aucdbg)=", "; \1=");
// set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
// set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");
// if (req.http.Cookie == "") {
// unset req.http.Cookie;
// }
//}
aucdbg
cookie is removed from the request by this VCL snipped. See also #2157165 in the issue queue.