// Opt-in example: this Vhost uses "session" while an unrelated Drupal 6 site // at the parent domain sets cookies named SESS or SSESS. // RustProxy 0.39.1 (with prefix selector support) only: remove_req_cookies() // supports exact names and a single trailing '*' for case-sensitive prefixes. // Not standard Varnish VCL. A normal 0.39.1 binary without this patch will // treat "SESS*" as an exact literal name and WILL NOT strip Drupal cookies. // // Only install after confirming this Vhost never uses SESS* or SSESS* for // authentication, personalization, CSRF protection, or other state. // Keep CDN technical-cookie rules separate and later than this rule. // Retain "CDN: bypass remaining cookies" to protect unknown session cookies. sub vcl_recv { // Subdomain's OWN login cookie must always skip shared cache. if (req.http.Cookie ~ "(?:^|;[ \\t]*)session=") { return(pass); } if ((req.method == "GET" || req.method == "HEAD") && req.http.Cookie && !req.http.Authorization && req.url !~ "^/(admin|api|auth|login|logout|account|profile|user|settings|dashboard|cart|checkout|panel|konto|wp-admin|wp-login[.]php)(/|[?]|$)") { // Drupal 6 parent-domain session name changes with the site/hash. // Analytics cookies below are also safe only when nonfunctional here. remove_req_cookies("SESS*", "SSESS*", "_ga", "_ga_*", "_gid"); } }