Skip to content

Commit 3ea9375

Browse files
committed
fix: relax the conditions for caching 404s
1 parent bbedbdb commit 3ea9375

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/run/headers.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function setCacheControlFromRequestContext(
217217
// if we are serving already stale response, instruct edge to not attempt to cache that response
218218
headers.get('x-nextjs-cache') === 'STALE'
219219
? 'public, max-age=0, must-revalidate, durable'
220-
: `s-maxage=${revalidate === false ? 31536000 : revalidate}, stale-while-revalidate=31536000, durable`
220+
: `s-maxage=${revalidate || 31536000}, stale-while-revalidate=31536000, durable`
221221

222222
headers.set('netlify-cdn-cache-control', cdnCacheControl)
223223
}
@@ -261,8 +261,6 @@ export const setCacheControlHeaders = (
261261
}
262262

263263
if (
264-
(!cacheControl || cacheControl.includes('no-store')) &&
265-
typeof requestContext.pageHandlerRevalidate !== 'undefined' &&
266264
['GET', 'HEAD'].includes(request.method) &&
267265
!headers.has('cdn-cache-control') &&
268266
!headers.has('netlify-cdn-cache-control')

0 commit comments

Comments
 (0)