Skip to content

Commit

Permalink
Merge pull request #82 from alphagov/serve-stale-content-dgu
Browse files Browse the repository at this point in the history
Handle errors and deliver stale content
  • Loading branch information
MahmudH authored Jun 4, 2024
2 parents 872a997 + 58c5815 commit 075ecaa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/datagovuk/datagovuk.vcl.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ 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;
}
}

set beresp.stale_if_error = 86400s;
%{ endif ~}


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

Expand Down

0 comments on commit 075ecaa

Please sign in to comment.