Skip to content

Instantly share code, notes, and snippets.

@rezan
Last active February 5, 2016 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezan/d877af0dcbb16b35aeaf to your computer and use it in GitHub Desktop.
Save rezan/d877af0dcbb16b35aeaf to your computer and use it in GitHub Desktop.
Varnish 4 grace
# conditional grace for healthy/unhealthy (30s/1h)
vcl 4.0;
import std;
sub vcl_hit {
if (std.healthy(req.backend_hint) && obj.ttl + 30s < 0s) {
return(fetch);
}
}
sub vcl_backend_response {
set beresp.grace = 1h;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment