docs: add cache-control headers

This commit is contained in:
bd_ 2023-10-11 20:06:55 +09:00
parent 9d744710da
commit 751618684b
2 changed files with 4 additions and 3 deletions

View File

@ -127,5 +127,3 @@ jobs:
with:
cf_zone: ${{ secrets.CF_ZONE_ID }}
cf_auth: ${{ secrets.CF_API_TOKEN }}
hosts: |
modular-avatar.nadena.dev

View File

@ -74,6 +74,7 @@ async function handleEvent(event) {
Vary: 'Accept-Language',
},
});
response.headers.set("Cache-Control", "private");
} else if (strip_match !== null) {
console.log("=== Redirect");
response = new Response("Redirecting", {
@ -82,6 +83,7 @@ async function handleEvent(event) {
Location: strip_match[1],
}
});
response.headers.set("Cache-control", "public, max-age=3600");
} else {
let page;
try {
@ -97,6 +99,7 @@ async function handleEvent(event) {
// allow headers to be altered
response = new Response(page.body, page);
response.headers.set("Cache-control", "public, max-age=3600");
}
response.headers.set("X-XSS-Protection", "1; mode=block");