From bced3ec3f49cbc363ae0e5672263054cdcf37cbe Mon Sep 17 00:00:00 2001 From: Amio Date: Wed, 12 Jun 2019 19:57:13 +0800 Subject: [PATCH] Add cache-control header to doc pages --- endpoints/docs.ts | 3 +++ index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/endpoints/docs.ts b/endpoints/docs.ts index e1e3212..7b2b719 100644 --- a/endpoints/docs.ts +++ b/endpoints/docs.ts @@ -9,6 +9,9 @@ export default async function (req, res) { if (helpMarkdown) { console.info(`DOC ${name}: ${req.url}`) + + res.setHeader('Cache-Control', 'public, max-age=86400, s-maxage=604800, stale-while-revalidate=86400') + return serveMarked(helpMarkdown, { title: `${name} badge | Badgen`, inlineCSS, diff --git a/index.ts b/index.ts index b0018de..8f7dda1 100644 --- a/index.ts +++ b/index.ts @@ -28,7 +28,7 @@ const serveStaticHeaders = [ source: "**/*", headers: [{ key: "Cache-Control", - value: "public, max-age=86400, s-maxage=86400, stale-while-revalidate=86400" + value: "public, max-age=86400, s-maxage=604800, stale-while-revalidate=86400" }] } ]