Skip to content

Commit

Permalink
Set default stale-while-revalidate header value to 1 year (#65867)
Browse files Browse the repository at this point in the history
  • Loading branch information
flybayer committed May 16, 2024
1 parent cd5287e commit a753a39
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/next/src/server/lib/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit a753a39

Please sign in to comment.