cloudflare / templates

A collection of starter templates and examples for Cloudflare Workers and Pages
https://cloudflareworkers.com
MIT License
999 stars 632 forks source link

Preserving Cache Copy if 5xx error or timeout with non-KV. #58

Closed BradFD closed 1 year ago

BradFD commented 4 years ago

We are using the non-KV stale while revalidate path. A great functionality would be, when doing the update of the cached copy of the page, if the origin returns a 5xx response or timeout then don't purge the cache for that page and continue to serve the prior non-5xx page that was last cached to visitors. I think I need to update the function starting at line 249 in the edge cache example but I am kind of lost because I do more admin than programming and haven't used javascript much. Is this an easy change? Would it break other things?

lauragift21 commented 1 year ago

Closing because the issue was fixed!