From 8e5555abb99f76c03d874c1c055679e7b10efb39 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 11 Apr 2025 11:17:48 +0200 Subject: [PATCH 1/2] fix: forcefully add _rsc query param to vary --- src/run/headers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/run/headers.ts b/src/run/headers.ts index 35a1a4b37a..b31c0b6fbc 100644 --- a/src/run/headers.ts +++ b/src/run/headers.ts @@ -81,7 +81,7 @@ export const setVaryHeaders = ( header: ['x-nextjs-data', 'x-next-debug-logging'], language: [], cookie: ['__prerender_bypass', '__next_preview_data'], - query: ['__nextDataReq'], + query: ['__nextDataReq', '_rsc'], country: [], } From 2e3284130a99ca85b8cb6f69c32658fc963130a8 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 11 Apr 2025 11:50:17 +0200 Subject: [PATCH 2/2] test: update assertions for added _rsc query variation --- src/run/headers.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/run/headers.test.ts b/src/run/headers.test.ts index f20bee6a41..fc4060b0d7 100644 --- a/src/run/headers.test.ts +++ b/src/run/headers.test.ts @@ -40,7 +40,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq,header=x-nextjs-data|x-next-debug-logging,cookie=__prerender_bypass|__next_preview_data', + 'query=__nextDataReq|_rsc,header=x-nextjs-data|x-next-debug-logging,cookie=__prerender_bypass|__next_preview_data', ) }) @@ -56,7 +56,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq,header=x-nextjs-data|x-next-debug-logging|Accept|Accept-Language,cookie=__prerender_bypass|__next_preview_data', + 'query=__nextDataReq|_rsc,header=x-nextjs-data|x-next-debug-logging|Accept|Accept-Language,cookie=__prerender_bypass|__next_preview_data', ) }) @@ -77,7 +77,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq,header=x-nextjs-data|x-next-debug-logging,cookie=__prerender_bypass|__next_preview_data', + 'query=__nextDataReq|_rsc,header=x-nextjs-data|x-next-debug-logging,cookie=__prerender_bypass|__next_preview_data', ) }) @@ -97,7 +97,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq,header=x-nextjs-data|x-next-debug-logging,cookie=__prerender_bypass|__next_preview_data', + 'query=__nextDataReq|_rsc,header=x-nextjs-data|x-next-debug-logging,cookie=__prerender_bypass|__next_preview_data', ) }) @@ -117,7 +117,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq,header=x-nextjs-data|x-next-debug-logging,language=en|de|fr,cookie=__prerender_bypass|__next_preview_data|NEXT_LOCALE', + 'query=__nextDataReq|_rsc,header=x-nextjs-data|x-next-debug-logging,language=en|de|fr,cookie=__prerender_bypass|__next_preview_data|NEXT_LOCALE', ) }) @@ -138,7 +138,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq,header=x-nextjs-data|x-next-debug-logging,language=en|de|fr,cookie=__prerender_bypass|__next_preview_data|NEXT_LOCALE', + 'query=__nextDataReq|_rsc,header=x-nextjs-data|x-next-debug-logging,language=en|de|fr,cookie=__prerender_bypass|__next_preview_data|NEXT_LOCALE', ) }) @@ -185,7 +185,7 @@ describe('headers', () => { expect(headers.set).toBeCalledWith( 'netlify-vary', - 'query=__nextDataReq|item_id|page|per_page,header=x-nextjs-data|x-next-debug-logging|x-custom-header,language=en|de|fr|es,cookie=__prerender_bypass|__next_preview_data|NEXT_LOCALE|ab_test,country=es', + 'query=__nextDataReq|_rsc|item_id|page|per_page,header=x-nextjs-data|x-next-debug-logging|x-custom-header,language=en|de|fr|es,cookie=__prerender_bypass|__next_preview_data|NEXT_LOCALE|ab_test,country=es', ) }) })