async function handle(req) {
// Send the request to `origin_0`.
const resp = await fetch(req, {
backend: "origin_0"
});
// Cache-Control: no-store prevents browsers from writing the object to disk.
// We add 'private' in case there are any public caches downstream of Fastly,
// between us and the browser, which might perform request collapsing on public content
resp.headers.set("cache-control", "private, no-store");
// Remove all other caching-related response headers
resp.headers.delete("expires");
resp.headers.delete("etag");
resp.headers.delete("last-modified");
return resp;
}
addEventListener("fetch", event => event.respondWith(handle(event.request)));