/// <reference types="@fastly/js-compute" />
const handler = async (event) => {
// Get the request from the client.
const req = event.request;
const backendResponse = await fetch(req, {
backend: "origin_0"
});
if (!req.headers.has("Fastly-FF")) {
backendResponse.headers.set("Cache-Control", "private, no-cache");
}
return backendResponse;
}
addEventListener("fetch", event => event.respondWith(handler(event)));