@@ -1392,17 +1392,10 @@ test.describe('Page Router with basePath and i18n', () => {
1392
1392
1393
1393
expect ( await page . textContent ( 'p' ) ) . toBe ( 'Custom 404 page for locale: en' )
1394
1394
1395
- // https://github.com/vercel/next.js/pull/69802 made changes to returned cache-control header,
1396
- // after that 404 pages would have `private` directive, before that it would not
1397
- const shouldHavePrivateDirective = nextVersionSatisfies ( '^14.2.10 || >=15.0.0-canary.147' )
1398
- expect ( headers [ 'debug-netlify-cdn-cache-control' ] ) . toBe (
1399
- ( shouldHavePrivateDirective ? 'private, ' : '' ) +
1400
- 'no-cache, no-store, max-age=0, must-revalidate, durable' ,
1401
- )
1402
- expect ( headers [ 'cache-control' ] ) . toBe (
1403
- ( shouldHavePrivateDirective ? 'private,' : '' ) +
1404
- 'no-cache,no-store,max-age=0,must-revalidate' ,
1395
+ expect ( headers [ 'debug-netlify-cdn-cache-control' ] ) . toMatch (
1396
+ / n o - c a c h e , n o - s t o r e , m a x - a g e = 0 , m u s t - r e v a l i d a t e , d u r a b l e / m,
1405
1397
)
1398
+ expect ( headers [ 'cache-control' ] ) . toMatch ( / n o - c a c h e , n o - s t o r e , m a x - a g e = 0 , m u s t - r e v a l i d a t e / m)
1406
1399
} )
1407
1400
1408
1401
test ( 'requesting a non existing page route that needs to be fetched from the blob store like 404.html (notFound: true)' , async ( {
@@ -1417,12 +1410,16 @@ test.describe('Page Router with basePath and i18n', () => {
1417
1410
1418
1411
expect ( await page . textContent ( 'p' ) ) . toBe ( 'Custom 404 page for locale: en' )
1419
1412
1420
- expect ( headers [ 'debug-netlify-cdn-cache-control' ] ) . toBe (
1421
- nextVersionSatisfies ( '>=15.0.0-canary.187' )
1422
- ? 's-maxage=31536000, durable'
1423
- : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
1424
- )
1425
- expect ( headers [ 'cache-control' ] ) . toBe ( 'public,max-age=0,must-revalidate' )
1413
+ // Prior to v14.2.4 notFound pages are not cacheable
1414
+ // https://github.com/vercel/next.js/pull/66674
1415
+ if ( nextVersionSatisfies ( '>= 14.2.4' ) ) {
1416
+ expect ( headers [ 'debug-netlify-cdn-cache-control' ] ) . toBe (
1417
+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
1418
+ ? 's-maxage=31536000, durable'
1419
+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
1420
+ )
1421
+ expect ( headers [ 'cache-control' ] ) . toBe ( 'public,max-age=0,must-revalidate' )
1422
+ }
1426
1423
} )
1427
1424
1428
1425
test . describe ( 'static assets and function invocations' , ( ) => {
0 commit comments