From 7d30147882cdb246808423b4abf6249fc5b0908b Mon Sep 17 00:00:00 2001 From: gcolpart Date: Mon, 31 Oct 2016 02:40:13 +0100 Subject: [PATCH] =?UTF-8?q?am=C3=A9lioration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HowtoVarnish.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/HowtoVarnish.md b/HowtoVarnish.md index 442dd31b..b21c44a7 100644 --- a/HowtoVarnish.md +++ b/HowtoVarnish.md @@ -339,15 +339,7 @@ Le temps de mise en cache par défaut peut être défini avec l'option `-t` à [ sub vcl_backend_response { set beresp.ttl = 1800s; #unset beresp.http.expires; - set beresp.http.cache-control = "max-age=1800"; - set beresp.http.magicmarker = "1"; -} - -sub vcl_deliver { - if (resp.http.magicmarker) { - unset resp.http.magicmarker; - set resp.http.age = "0"; - } + set beresp.http.Cache-Control = "max-age=1800"; } ~~~ @@ -362,6 +354,17 @@ sub vcl_recv { if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID)") { return (pass); } + + if (req.http.cookie) { + set req.http.Cookie = regsuball(req.http.Cookie, "_gat=[^;]+(; )?", ""); # Google Analytics + set req.http.Cookie = regsuball(req.http.Cookie, "_ga=[^;]+(; )?", ""); # Google Analytics + set req.http.Cookie = regsuball(req.http.Cookie, "_gaq=[^;]+(; )?", ""); # Google Analytics + set req.http.Cookie = regsuball(req.http.Cookie, "__utm[^=]*=[^;]+(; )?", ""); # Google Analytics + + if (req.http.cookie ~ "^ *$") { + unset req.http.cookie; + } + } } sub vcl_backend_response {