Do more generous caching, cache stuff with etags and that either have a public cache header or no cache header
This commit is contained in:
parent
3e9080e219
commit
1e18560a7e
|
@ -8,6 +8,7 @@ backend default {
|
||||||
.between_bytes_timeout = 2s;
|
.between_bytes_timeout = 2s;
|
||||||
}
|
}
|
||||||
sub vcl_recv {
|
sub vcl_recv {
|
||||||
|
unset req.http.user-agent;
|
||||||
if ( req.method != "GET" &&
|
if ( req.method != "GET" &&
|
||||||
req.method != "HEAD" &&
|
req.method != "HEAD" &&
|
||||||
req.method != "PUT" &&
|
req.method != "PUT" &&
|
||||||
|
@ -21,7 +22,7 @@ sub vcl_recv {
|
||||||
if (req.http.Upgrade ~ "(?i)websocket") {
|
if (req.http.Upgrade ~ "(?i)websocket") {
|
||||||
return (pipe);
|
return (pipe);
|
||||||
}
|
}
|
||||||
if (req.http.Range) {
|
if (req.http.range) {
|
||||||
return (pass);
|
return (pass);
|
||||||
}
|
}
|
||||||
if (req.method == "GET" || req.method == "HEAD") {
|
if (req.method == "GET" || req.method == "HEAD") {
|
||||||
|
@ -50,14 +51,14 @@ sub vcl_pipe {
|
||||||
return (pipe);
|
return (pipe);
|
||||||
}
|
}
|
||||||
sub vcl_backend_response {
|
sub vcl_backend_response {
|
||||||
if (beresp.status == 500 || beresp.status == 502 || beresp.status == 503 || beresp.status == 504) {
|
if (beresp.http.Cache-Control ~ "private") {
|
||||||
return (abandon);
|
return (pass);
|
||||||
}
|
}
|
||||||
if (beresp.http.Cache-Control ~ "public") {
|
if (beresp.http.ETag || beresp.http.Last-Modified) {
|
||||||
return (deliver);
|
set beresp.keep = 4h;
|
||||||
}
|
}
|
||||||
if (beresp.status == 301) {
|
if (beresp.status == 301) {
|
||||||
return(deliver);
|
set beresp.ttl = 24h;
|
||||||
}
|
}
|
||||||
return (pass);
|
return (deliver);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue