Skip to content

Commit ae79440

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

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

+6
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)