Add grace and keep periods and skip cache on big files

This commit is contained in:
Alex 2020-06-19 23:24:36 +02:00
parent f1c3802434
commit e92e27ddfb
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 4 additions and 4 deletions

View File

@ -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;
}