From 18c692fc223ae5a7383552d21017339d2945a833 Mon Sep 17 00:00:00 2001 From: Jon Pentland Date: Tue, 29 Aug 2017 10:42:35 +0100 Subject: [PATCH] Strip query string before testing which urls to strip cookies on --- CHANGES.rst | 3 ++- plone/recipe/varnish/templates/varnish4.vcl.jinja2 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index c5d623d..b2562a3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 2.0a8 (unreleased) ------------------ -- Nothing changed yet. +- Stripped query string before testing which urls to strip cookies on. + https://github.com/collective/plone.recipe.varnish/issues/42 [instification] 2.0a7 (2017-08-16) diff --git a/plone/recipe/varnish/templates/varnish4.vcl.jinja2 b/plone/recipe/varnish/templates/varnish4.vcl.jinja2 index fc2ebaf..126deee 100644 --- a/plone/recipe/varnish/templates/varnish4.vcl.jinja2 +++ b/plone/recipe/varnish/templates/varnish4.vcl.jinja2 @@ -133,8 +133,9 @@ sub vcl_recv { /* cookies for pass */ {% for rule in cookiepass %} {# this part need review #} + set req.http.UrlNoQs = regsub(req.url, "\?.*$", ""); if (req.http.Cookie && req.http.Cookie ~ "{{rule['match']}}") { - if (req.url ~ "{{rule['exclude']}}") { + if (req.http.UrlNoQs ~ "{{rule['exclude']}}") { unset req.http.cookie; return(pipe); }