From e08e73836159258ce31593991ffe436b04ad7773 Mon Sep 17 00:00:00 2001 From: Zack Tanner Date: Thu, 1 Feb 2024 13:17:22 -0800 Subject: [PATCH] modify variable name --- packages/next/src/server/base-server.ts | 32 ++++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index bc88b139767d0..e3fbc3a43d4b4 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -2000,24 +2000,22 @@ export default abstract class Server { if (isAppPath) { res.setHeader('vary', RSC_VARY_HEADER) - if (isPrefetchRSCRequest) { - const couldBeRewritten = this.interceptionRouteRewrites?.some( - (rewrite) => { - return new RegExp(rewrite.regex).test(resolvedUrlPathname) - } - ) - - // Interception route responses can vary based on the `Next-URL` header as they're rewritten to different components. - // This means that multiple route interception responses can resolve to the same URL. We use the Vary header to signal this - // behavior to the client so that it can properly cache the response. - // If the request that we're handling is one that could have a different response based on the `Next-URL` header, or if - // we're handling an interception route, then we include `Next-URL` in the Vary header. - if ( - couldBeRewritten || - isInterceptionRouteAppPath(resolvedUrlPathname) - ) { - res.setHeader('vary', `${RSC_VARY_HEADER}, ${NEXT_URL}`) + const couldBeIntercepted = this.interceptionRouteRewrites?.some( + (rewrite) => { + return new RegExp(rewrite.regex).test(resolvedUrlPathname) } + ) + + // Interception route responses can vary based on the `Next-URL` header as they're rewritten to different components. + // This means that multiple route interception responses can resolve to the same URL. We use the Vary header to signal this + // behavior to the client so that it can properly cache the response. + // If the request that we're handling is one that could have a different response based on the `Next-URL` header, or if + // we're handling an interception route, then we include `Next-URL` in the Vary header. + if ( + couldBeIntercepted || + isInterceptionRouteAppPath(resolvedUrlPathname) + ) { + res.setHeader('vary', `${RSC_VARY_HEADER}, ${NEXT_URL}`) } if (!this.renderOpts.dev && !isPreviewMode && isSSG && isRSCRequest) {