Skip to content

Commit

Permalink
Use beresp.stale_if_error instead of deprecated beresp.grace
Browse files Browse the repository at this point in the history
  • Loading branch information
AgaDufrat committed Feb 16, 2024
1 parent 5c5799f commit 14224e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/assets/assets.vcl.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ sub vcl_fetch {

if (req.restarts == 0) {
# Keep stale for origin
set beresp.grace = 24h;
set beresp.stale_if_error = 24h;
}

if(req.restarts > 0 ) {
Expand All @@ -291,7 +291,7 @@ sub vcl_fetch {

if (beresp.status >= 500 && beresp.status <= 599) {
set beresp.ttl = 1s;
set beresp.grace = 5s;
set beresp.stale_if_error = 5s;
if (beresp.http.Fastly-Backend-Name ~ "mirrorS3") {
error 503 "Error page";
}
Expand Down
4 changes: 2 additions & 2 deletions modules/bouncer/bouncer.vcl.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sub vcl_fetch {
#FASTLY fetch


set beresp.grace = 86400s;
set beresp.stale_if_error = 86400s;

if ((beresp.status == 500 || beresp.status == 503) && req.restarts < 2 && (req.request == "GET" || req.request == "HEAD")) {
set beresp.saintmode = 5s;
Expand All @@ -94,7 +94,7 @@ sub vcl_fetch {

if (beresp.status == 500 || beresp.status == 503) {
set beresp.ttl = 1s;
set beresp.grace = 5s;
set beresp.stale_if_error = 5s;
return (deliver);
}

Expand Down
4 changes: 2 additions & 2 deletions modules/www/www.vcl.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ sub vcl_fetch {

if (req.restarts == 0) {
# Keep stale for origin
set beresp.grace = 24h;
set beresp.stale_if_error = 24h;
}

if(req.restarts > 0 ) {
Expand All @@ -388,7 +388,7 @@ sub vcl_fetch {

if (beresp.status >= 500 && beresp.status <= 599) {
set beresp.ttl = 1s;
set beresp.grace = 5s;
set beresp.stale_if_error = 5s;
if (beresp.http.Fastly-Backend-Name ~ "^mirror") {
error 503 "Error page";
}
Expand Down

0 comments on commit 14224e7

Please sign in to comment.