Skip to content

Commit 5dcb098

Browse files
committed
fix: added a vary header with RSC to get proper content-type
1 parent 5c0524c commit 5dcb098

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/runtime/src/templates/edge-shared/rsc-data.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export const getRscDataRouter = ({ routes: staticRoutes, dynamicRoutes }: Preren
6060
const debug = request.headers.has('x-next-debug-logging')
6161
const log = debug ? (...args: unknown[]) => console.log(...args) : noop
6262
const url = new URL(request.url)
63+
64+
// Set the 'vary' header to 'RSC' to ensure that we cache correctly for the different
65+
// possible mime types: application/octet-stream and text/html
66+
// See https://github.com/netlify/pod-ecosystem-frameworks/issues/352#issuecomment-1450364417
67+
request.headers.set('vary', 'RSC')
68+
6369
// If this is a static RSC request, rewrite to the data route
6470
if (request.headers.get('rsc') === '1') {
6571
log('Is rsc request')

0 commit comments

Comments
 (0)