Skip to content

Instantly share code, notes, and snippets.

@dancriel
dancriel / grace-v4.vcl
Last active August 4, 2023 06:56 — forked from perbu/grave-v4.vcl
Automatically enable grace for all objects in Varnish 5
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return(deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";