From f8767fae878398b7182c92b87be486d8bbaab6a7 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Sat, 5 Mar 2016 15:06:11 +0000 Subject: [PATCH] Be a bit more verbose on varnish cache clear Signed-off-by: Patrick Uiterwijk --- roles/varnish/templates/proxy.vcl.j2 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/varnish/templates/proxy.vcl.j2 b/roles/varnish/templates/proxy.vcl.j2 index 812b94bc70..e21d00cf11 100644 --- a/roles/varnish/templates/proxy.vcl.j2 +++ b/roles/varnish/templates/proxy.vcl.j2 @@ -349,3 +349,24 @@ sub vcl_backend_response { set beresp.ttl = 6h; } } + +sub vcl_pipe { + set req.http.connection = "close"; +} + +sub vcl_hit { + if (req.method == "PURGE") { + ban(req.url); + return (synth(200, "Purged")); + } + + if (!obj.ttl > 0s) { + return (pass); + } +} + +sub vcl_miss { + if (req.method == "PURGE") { + return (synth(200, "Not in cache")); + } +}