From 7acc109c0c6f7da90f0f2d68b39410be8f88950c Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 11 Oct 2023 20:06:55 +0900 Subject: [PATCH] docs: add cache-control headers --- .github/workflows/deploy-pages.yml | 4 +--- docs-site~/src/index.js | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 450f8873..86e4cd08 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -126,6 +126,4 @@ jobs: continue-on-error: true with: cf_zone: ${{ secrets.CF_ZONE_ID }} - cf_auth: ${{ secrets.CF_API_TOKEN }} - hosts: | - modular-avatar.nadena.dev \ No newline at end of file + cf_auth: ${{ secrets.CF_API_TOKEN }} \ No newline at end of file diff --git a/docs-site~/src/index.js b/docs-site~/src/index.js index d6fc6969..4bd326d7 100644 --- a/docs-site~/src/index.js +++ b/docs-site~/src/index.js @@ -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");