1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/middleware/set-fastly-surrogate-key.js
Kevin Heis 8a56437c93 Pretty format (#20352)
* Update prettier flow to include JS

* Run prettier

* ...run prettier
2021-07-14 14:35:01 -07:00

13 lines
617 B
JavaScript

export default function setFastlySurrogateKey(req, res, next) {
// Fastly provides a Soft Purge feature that allows you to mark content as outdated (stale) instead of permanently
// purging and thereby deleting it from Fastly's caches. Objects invalidated with Soft Purge will be treated as
// outdated (stale) while Fastly fetches a new version from origin.
//
// Use of a surrogate key is required for soft purging
// https://docs.fastly.com/en/guides/soft-purges
// https://docs.fastly.com/en/guides/getting-started-with-surrogate-keys
res.set('surrogate-key', 'all-the-things')
return next()
}