From 5b21368d7ccb1bc9b0db6d3e63efcdaedff6ff2b Mon Sep 17 00:00:00 2001 From: skidoodle Date: Mon, 2 May 2022 13:28:38 +0200 Subject: [PATCH] better cache-control --- pages/api/s3.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pages/api/s3.tsx b/pages/api/s3.tsx index 13c628d..8996bee 100644 --- a/pages/api/s3.tsx +++ b/pages/api/s3.tsx @@ -19,7 +19,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) return acc + curr.Size! / 1024 / 1024 / 1024 }, 0) - res.setHeader('Cache-Control', 's-maxage=86400'); + res.setHeader( + 'Cache-Control', + 'public, s-maxage=10, stale-while-revalidate=59' + ) res.status(200).json (JSON.stringify({ 'objectCount': data.KeyCount, 'totalSize': (Math.round(totalsize * 100) / 100)