@@ -1392,10 +1392,17 @@ test.describe('Page Router with basePath and i18n', () => {
13921392
13931393 expect ( await page . textContent ( 'p' ) ) . toBe ( 'Custom 404 page for locale: en' )
13941394
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,
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' ,
13971405 )
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)
13991406 } )
14001407
14011408 test ( 'requesting a non existing page route that needs to be fetched from the blob store like 404.html (notFound: true)' , async ( {
@@ -1410,16 +1417,12 @@ test.describe('Page Router with basePath and i18n', () => {
14101417
14111418 expect ( await page . textContent ( 'p' ) ) . toBe ( 'Custom 404 page for locale: en' )
14121419
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- }
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' )
14231426 } )
14241427
14251428 test . describe ( 'static assets and function invocations' , ( ) => {
0 commit comments