Skip to content

Commit

Permalink
Handle errors and deliver stale content
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmudH committed May 29, 2024
1 parent 872a997 commit 1905424
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/datagovuk/datagovuk.vcl.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ sub vcl_recv {

sub vcl_fetch {
#FASTLY fetch
%{ if environment == "integration"}
if (beresp.status >= 500 && beresp.status < 600) {

if (stale.exists) {
return(deliver_stale)
}

if (req.restarts < 1 && (req.request == "GET" || req.request == "HEAD")) {
restart;
}
}
%{ endif ~}

set beresp.stale_if_error = 43200s;

set beresp.http.Fastly-Backend-Name = req.http.Fastly-Backend-Name;

Expand Down

0 comments on commit 1905424

Please sign in to comment.