From a753a394793d58184c02496bf2162f9e26d8a371 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Thu, 16 May 2024 16:32:19 -0700 Subject: [PATCH] Set default stale-while-revalidate header value to 1 year (#65867) --- packages/next/src/server/lib/revalidate.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/next/src/server/lib/revalidate.ts b/packages/next/src/server/lib/revalidate.ts index 23d9129d21146..7d97f37650b7e 100644 --- a/packages/next/src/server/lib/revalidate.ts +++ b/packages/next/src/server/lib/revalidate.ts @@ -17,9 +17,10 @@ export function formatRevalidate({ revalidate: Revalidate swrDelta?: SwrDelta }): string { - const swrHeader = swrDelta - ? `stale-while-revalidate=${swrDelta}` - : 'stale-while-revalidate' + const swrHeader = + swrDelta === undefined + ? `stale-while-revalidate=${CACHE_ONE_YEAR}` + : `stale-while-revalidate=${swrDelta}` if (revalidate === 0) { return 'private, no-cache, no-store, max-age=0, must-revalidate'