From a6478baddfe876c3be7991920a94f351d299a7b6 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 23 Aug 2023 19:43:36 +0100 Subject: [PATCH] feat: stale-while-revalidate for apis --- next.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/next.config.js b/next.config.js index 4220af4f..8ebb2244 100644 --- a/next.config.js +++ b/next.config.js @@ -83,6 +83,15 @@ module.exports = withBundleAnalyzer({ }, ], }, + { + source: "/api/:path*", + headers: [ + { + key: "Cache-Control", + value: "s-maxage=1, stale-while-revalidate", + }, + ], + }, ] }, staticPageGenerationTimeout: 3600,