Add grace and keep periods and skip cache on big files
This commit is contained in:
parent
f1c3802434
commit
e92e27ddfb
|
@ -1,4 +1,5 @@
|
||||||
vcl 4.1;
|
vcl 4.1;
|
||||||
|
import std;
|
||||||
|
|
||||||
backend default {
|
backend default {
|
||||||
.path = "{{ varnish.backend.sock }}";
|
.path = "{{ varnish.backend.sock }}";
|
||||||
|
@ -45,20 +46,19 @@ sub vcl_miss {
|
||||||
return (fetch);
|
return (fetch);
|
||||||
}
|
}
|
||||||
sub vcl_pipe {
|
sub vcl_pipe {
|
||||||
if (req.http.upgrade) {
|
|
||||||
set bereq.http.upgrade = req.http.upgrade;
|
|
||||||
}
|
|
||||||
return (pipe);
|
return (pipe);
|
||||||
}
|
}
|
||||||
sub vcl_backend_response {
|
sub vcl_backend_response {
|
||||||
set beresp.do_stream = false;
|
set beresp.do_stream = false;
|
||||||
if ( beresp.http.Set-Cookie ||
|
if ( beresp.http.Set-Cookie ||
|
||||||
beresp.http.Cache-Control ~ "no-cache|no-store|private" ||
|
beresp.http.Cache-Control ~ "no-cache|no-store|private" ||
|
||||||
beresp.http.Vary == "*") {
|
std.integer(beresp.http.Content-Length, 0) > 20971520) {
|
||||||
set beresp.uncacheable = true;
|
set beresp.uncacheable = true;
|
||||||
return(deliver);
|
return(deliver);
|
||||||
}
|
}
|
||||||
set beresp.ttl = 120s;
|
set beresp.ttl = 120s;
|
||||||
|
set beresp.keep = 10s;
|
||||||
|
set beresp.grace = 30s;
|
||||||
if (beresp.http.ETag || beresp.http.Last-Modified) {
|
if (beresp.http.ETag || beresp.http.Last-Modified) {
|
||||||
set beresp.keep = 4h;
|
set beresp.keep = 4h;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue