Update varnish/default.vcl
This commit is contained in:
1 parent
92a87fdb56
commit
55f0d1ffd9
1 file changed
+7
-17
+7
-17
@@ -21,7 +21,6 @@ backend default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
acl purge {
|
acl purge {
|
||||||
"localhost";
|
|
||||||
"127.0.0.1";
|
"127.0.0.1";
|
||||||
"::1";
|
"::1";
|
||||||
}
|
}
|
||||||
@@ -127,17 +126,10 @@ sub vcl_hash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub vcl_hit {
|
sub vcl_hit {
|
||||||
if (obj.ttl >= 0s) {
|
# Varnish przechodzi do vcl_miss sam, kiedy TTL i grace wygasna.
|
||||||
set req.http.X-CS-Decision = "hit";
|
# Dla swiezego obiektu lub obiektu w grace zwracamy HIT.
|
||||||
return (deliver);
|
set req.http.X-CS-Decision = "hit";
|
||||||
}
|
return (deliver);
|
||||||
if (obj.ttl + obj.grace > 0s) {
|
|
||||||
set req.http.X-CS-Decision = "hit";
|
|
||||||
return (deliver);
|
|
||||||
}
|
|
||||||
# Odswiezenie po wyczerpaniu grace to fwd=stale, nie uri-miss.
|
|
||||||
set req.http.X-CS-Decision = "stale";
|
|
||||||
return (miss);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub vcl_miss {
|
sub vcl_miss {
|
||||||
@@ -288,13 +280,11 @@ sub vcl_deliver {
|
|||||||
set resp.http.X-CS-Entry = "varnish; fwd=request";
|
set resp.http.X-CS-Entry = "varnish; fwd=request";
|
||||||
} elseif (req.http.X-CS-Decision == "bypass") {
|
} elseif (req.http.X-CS-Decision == "bypass") {
|
||||||
set resp.http.X-CS-Entry = "varnish; fwd=bypass";
|
set resp.http.X-CS-Entry = "varnish; fwd=bypass";
|
||||||
} elseif (req.http.X-CS-Decision == "miss" || req.http.X-CS-Decision == "stale") {
|
} elseif (req.http.X-CS-Decision == "miss") {
|
||||||
if (!obj.uncacheable && obj.ttl > 0s) {
|
if (!obj.uncacheable && obj.ttl > 0s) {
|
||||||
set resp.http.X-CS-Entry = "varnish; fwd=" +
|
set resp.http.X-CS-Entry = "varnish; fwd=uri-miss; stored";
|
||||||
regsub(req.http.X-CS-Decision, "^miss$", "uri-miss") + "; stored";
|
|
||||||
} else {
|
} else {
|
||||||
set resp.http.X-CS-Entry = "varnish; fwd=" +
|
set resp.http.X-CS-Entry = "varnish; fwd=uri-miss; stored=?0";
|
||||||
regsub(req.http.X-CS-Decision, "^miss$", "uri-miss") + "; stored=?0";
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# Zabezpieczenie na nietypowe ścieżki VCL.
|
# Zabezpieczenie na nietypowe ścieżki VCL.
|
||||||
|
|||||||
Reference in new issue
Block a user