Skip to content

Commit

Permalink
modify variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Feb 1, 2024
1 parent 53592ae commit e08e738
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2000,24 +2000,22 @@ export default abstract class Server<ServerOptions extends Options = Options> {
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) {
Expand Down

0 comments on commit e08e738

Please sign in to comment.