From e92e27ddfb93af79b6acbc1114f2c706654fdc31 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 19 Jun 2020 23:24:36 +0200 Subject: [PATCH] Add grace and keep periods and skip cache on big files --- templates/varnish.vcl.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/varnish.vcl.j2 b/templates/varnish.vcl.j2 index b381c50..c99a633 100644 --- a/templates/varnish.vcl.j2 +++ b/templates/varnish.vcl.j2 @@ -1,4 +1,5 @@ vcl 4.1; +import std; backend default { .path = "{{ varnish.backend.sock }}"; @@ -45,20 +46,19 @@ sub vcl_miss { return (fetch); } sub vcl_pipe { - if (req.http.upgrade) { - set bereq.http.upgrade = req.http.upgrade; - } return (pipe); } sub vcl_backend_response { set beresp.do_stream = false; if ( beresp.http.Set-Cookie || beresp.http.Cache-Control ~ "no-cache|no-store|private" || - beresp.http.Vary == "*") { + std.integer(beresp.http.Content-Length, 0) > 20971520) { set beresp.uncacheable = true; return(deliver); } set beresp.ttl = 120s; + set beresp.keep = 10s; + set beresp.grace = 30s; if (beresp.http.ETag || beresp.http.Last-Modified) { set beresp.keep = 4h; }