{"version":3,"sources":["../../src/server/base-server.ts"],"sourcesContent":["import type { __ApiPreviewProps } from './api-utils'\nimport type { LoadComponentsReturnType } from './load-components'\nimport type { MiddlewareRouteMatch } from '../shared/lib/router/utils/middleware-route-matcher'\nimport type { Params } from './request/params'\nimport type { NextConfig, NextConfigComplete } from './config-shared'\nimport type {\n NextParsedUrlQuery,\n NextUrlWithParsedQuery,\n RequestMeta,\n} from './request-meta'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { RenderOptsPartial as PagesRenderOptsPartial } from './render'\nimport type {\n RenderOptsPartial as AppRenderOptsPartial,\n ServerOnInstrumentationRequestError,\n} from './app-render/types'\nimport type {\n ServerComponentsHmrCache,\n ResponseCacheBase,\n} from './response-cache'\nimport type { UrlWithParsedQuery } from 'url'\nimport {\n NormalizeError,\n DecodeError,\n normalizeRepeatedSlashes,\n MissingStaticPage,\n} from '../shared/lib/utils'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\nimport type { BaseNextRequest, BaseNextResponse } from './base-http'\nimport type {\n ManifestRewriteRoute,\n ManifestRoute,\n PrerenderManifest,\n} from '../build'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type { NextFontManifest } from '../build/webpack/plugins/next-font-manifest-plugin'\nimport type { PagesAPIRouteMatch } from './route-matches/pages-api-route-match'\nimport type {\n Server as HTTPServer,\n IncomingMessage,\n ServerResponse as HTTPServerResponse,\n} from 'http'\nimport type { ProxyMatcher } from '../build/analysis/get-page-static-info'\nimport type { TLSSocket } from 'tls'\nimport type { PathnameNormalizer } from './normalizers/request/pathname-normalizer'\nimport type { InstrumentationModule } from './instrumentation/types'\n\nimport * as path from 'path'\nimport { format as formatUrl, parse as parseUrl } from 'url'\nimport { formatHostname } from './lib/format-hostname'\nimport {\n APP_PATHS_MANIFEST,\n NEXT_BUILTIN_DOCUMENT,\n PAGES_MANIFEST,\n STATIC_STATUS_PAGES,\n UNDERSCORE_NOT_FOUND_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../shared/lib/constants'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { execOnce } from '../shared/lib/utils'\nimport { isBlockedPage } from './utils'\nimport { getBotType, isBot } from '../shared/lib/router/utils/is-bot'\nimport RenderResult from './render-result'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport * as Log from '../build/output/log'\nimport { getServerUtils } from './server-utils'\nimport isError, { getProperError } from '../lib/is-error'\nimport {\n addRequestMeta,\n getRequestMeta,\n removeRequestMeta,\n setRequestMeta,\n} from './request-meta'\nimport { removePathPrefix } from '../shared/lib/router/utils/remove-path-prefix'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport { getHostname } from '../shared/lib/get-hostname'\nimport { parseUrl as parseUrlUtil } from '../shared/lib/router/utils/parse-url'\nimport { getNextPathnameInfo } from '../shared/lib/router/utils/get-next-pathname-info'\nimport {\n RSC_HEADER,\n NEXT_RSC_UNION_QUERY,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_URL,\n NEXT_ROUTER_STATE_TREE_HEADER,\n} from '../client/components/app-router-headers'\nimport type {\n MatchOptions,\n RouteMatcherManager,\n} from './route-matcher-managers/route-matcher-manager'\nimport { LocaleRouteNormalizer } from './normalizers/locale-route-normalizer'\nimport { DefaultRouteMatcherManager } from './route-matcher-managers/default-route-matcher-manager'\nimport { AppPageRouteMatcherProvider } from './route-matcher-providers/app-page-route-matcher-provider'\nimport { AppRouteRouteMatcherProvider } from './route-matcher-providers/app-route-route-matcher-provider'\nimport { PagesAPIRouteMatcherProvider } from './route-matcher-providers/pages-api-route-matcher-provider'\nimport { PagesRouteMatcherProvider } from './route-matcher-providers/pages-route-matcher-provider'\nimport { ServerManifestLoader } from './route-matcher-providers/helpers/manifest-loaders/server-manifest-loader'\nimport {\n getTracer,\n isBubbledError,\n SpanKind,\n SpanStatusCode,\n} from './lib/trace/tracer'\nimport { BaseServerSpan } from './lib/trace/constants'\nimport { I18NProvider } from './lib/i18n-provider'\nimport { sendResponse } from './send-response'\nimport { normalizeNextQueryParam } from './web/utils'\nimport {\n HTML_CONTENT_TYPE_HEADER,\n JSON_CONTENT_TYPE_HEADER,\n MATCHED_PATH_HEADER,\n NEXT_RESUME_HEADER,\n} from '../lib/constants'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { matchNextDataPathname } from './lib/match-next-data-pathname'\nimport getRouteFromAssetPath from '../shared/lib/router/utils/get-route-from-asset-path'\nimport { RSCPathnameNormalizer } from './normalizers/request/rsc'\nimport { stripFlightHeaders } from './app-render/strip-flight-headers'\nimport {\n isAppPageRouteModule,\n isAppRouteRouteModule,\n} from './route-modules/checks'\nimport { PrefetchRSCPathnameNormalizer } from './normalizers/request/prefetch-rsc'\nimport { NextDataPathnameNormalizer } from './normalizers/request/next-data'\nimport { getIsPossibleServerAction } from './lib/server-action-request-meta'\nimport { isInterceptionRouteAppPath } from '../shared/lib/router/utils/interception-routes'\nimport { toRoute } from './lib/to-route'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isNodeNextRequest, isNodeNextResponse } from './base-http/helpers'\nimport { patchSetHeaderWithCookieSupport } from './lib/patch-set-header'\nimport { checkIsAppPPREnabled } from './lib/experimental/ppr'\nimport {\n getBuiltinRequestContext,\n type WaitUntil,\n} from './after/builtin-request-context'\nimport { NextRequestHint } from './web/adapter'\nimport type { RouteModule } from './route-modules/route-module'\nimport { type FallbackMode, parseFallbackField } from '../lib/fallback'\nimport { SegmentPrefixRSCPathnameNormalizer } from './normalizers/request/segment-prefix-rsc'\nimport { shouldServeStreamingMetadata } from './lib/streaming-metadata'\nimport { decodeQueryPathParameter } from './lib/decode-query-path-parameter'\nimport { NoFallbackError } from '../shared/lib/no-fallback-error.external'\nimport { fixMojibake } from './lib/fix-mojibake'\nimport { computeCacheBustingSearchParam } from '../shared/lib/router/utils/cache-busting-search-param'\nimport { setCacheBustingSearchParamWithHash } from '../client/components/router-reducer/set-cache-busting-search-param'\nimport type { CacheControl } from './lib/cache-control'\nimport type { PrerenderedRoute } from '../build/static-paths/types'\nimport { createOpaqueFallbackRouteParams } from './request/fallback-params'\nimport { RouteKind } from './route-kind'\n\nexport type FindComponentsResult = {\n components: LoadComponentsReturnType\n query: NextParsedUrlQuery\n}\n\nexport interface MiddlewareRoutingItem {\n page: string\n match: MiddlewareRouteMatch\n matchers?: ProxyMatcher[]\n}\n\nexport type RouteHandler<\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> = (\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: NextUrlWithParsedQuery\n) => PromiseLike | boolean\n\n/**\n * The normalized route manifest is the same as the route manifest, but with\n * the rewrites normalized to the object shape that the router expects.\n */\nexport type NormalizedRouteManifest = {\n readonly dynamicRoutes: ReadonlyArray\n readonly rewrites: {\n readonly beforeFiles: ReadonlyArray\n readonly afterFiles: ReadonlyArray\n readonly fallback: ReadonlyArray\n }\n}\n\nexport interface Options {\n /**\n * Object containing the configuration next.config.js\n */\n conf: NextConfig\n /**\n * Set to false when the server was created by Next.js\n */\n customServer?: boolean\n /**\n * Tells if Next.js is running in dev mode\n */\n dev?: boolean\n /**\n * Enables the experimental testing mode.\n */\n experimentalTestProxy?: boolean\n\n /**\n * Whether or not the dev server is running in experimental HTTPS mode\n */\n experimentalHttpsServer?: boolean\n /**\n * Where the Next project is located\n */\n dir?: string\n /**\n * Tells if Next.js is at the platform-level\n */\n minimalMode?: boolean\n /**\n * Hide error messages containing server information\n */\n quiet?: boolean\n /**\n * The hostname the server is running behind\n */\n hostname?: string\n /**\n * The port the server is running behind\n */\n port?: number\n /**\n * The HTTP Server that Next.js is running behind\n */\n httpServer?: HTTPServer\n}\n\nexport type RenderOpts = PagesRenderOptsPartial & AppRenderOptsPartial\n\nexport type LoadedRenderOpts = RenderOpts &\n LoadComponentsReturnType &\n RequestLifecycleOpts\n\nexport type RequestLifecycleOpts = {\n waitUntil: ((promise: Promise) => void) | undefined\n onClose: (callback: () => void) => void\n onAfterTaskError: ((error: unknown) => void) | undefined\n}\n\ntype BaseRenderOpts = RenderOpts & {\n poweredByHeader: boolean\n generateEtags: boolean\n previewProps: __ApiPreviewProps\n}\n\n/**\n * The public interface for rendering with the server programmatically. This\n * would typically only allow the base request or response to extend it, but\n * because this can be programmatically accessed, we assume that it could also\n * be the base Node.js request and response types.\n */\nexport interface BaseRequestHandler<\n ServerRequest extends BaseNextRequest | IncomingMessage = BaseNextRequest,\n ServerResponse extends\n | BaseNextResponse\n | HTTPServerResponse = BaseNextResponse,\n> {\n (\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery | undefined\n ): Promise | void\n}\n\nexport type RequestContext<\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> = {\n req: ServerRequest\n res: ServerResponse\n pathname: string\n query: NextParsedUrlQuery\n renderOpts: RenderOpts\n}\n\n// Internal wrapper around build errors at development\n// time, to prevent us from propagating or logging them\nexport class WrappedBuildError extends Error {\n innerError: Error\n\n constructor(innerError: Error) {\n super()\n this.innerError = innerError\n }\n}\n\ntype ResponsePayload = {\n body: RenderResult\n cacheControl?: CacheControl\n}\n\nexport type NextEnabledDirectories = {\n readonly pages: boolean\n readonly app: boolean\n}\n\nexport default abstract class Server<\n ServerOptions extends Options = Options,\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> {\n public readonly hostname?: string\n public readonly fetchHostname?: string\n public readonly port?: number\n protected readonly dir: string\n protected readonly quiet: boolean\n protected readonly nextConfig: NextConfigComplete\n protected readonly distDir: string\n protected readonly publicDir: string\n protected readonly hasStaticDir: boolean\n protected readonly pagesManifest?: PagesManifest\n protected readonly appPathsManifest?: PagesManifest\n protected readonly buildId: string\n protected readonly minimalMode: boolean\n protected readonly renderOpts: BaseRenderOpts\n protected readonly serverOptions: Readonly\n protected readonly appPathRoutes?: Record\n protected readonly clientReferenceManifest?: DeepReadonly\n protected interceptionRoutePatterns: RegExp[]\n protected nextFontManifest?: DeepReadonly\n protected instrumentation: InstrumentationModule | undefined\n private readonly responseCache: ResponseCacheBase\n\n protected abstract getPublicDir(): string\n protected abstract getHasStaticDir(): boolean\n protected abstract getPagesManifest(): PagesManifest | undefined\n protected abstract getAppPathsManifest(): PagesManifest | undefined\n protected abstract getBuildId(): string\n protected abstract getinterceptionRoutePatterns(): RegExp[]\n\n protected readonly enabledDirectories: NextEnabledDirectories\n protected abstract getEnabledDirectories(dev: boolean): NextEnabledDirectories\n\n protected readonly experimentalTestProxy?: boolean\n\n protected abstract findPageComponents(params: {\n locale: string | undefined\n page: string\n query: NextParsedUrlQuery\n params: Params\n isAppPath: boolean\n // The following parameters are used in the development server's\n // implementation.\n sriEnabled?: boolean\n appPaths?: ReadonlyArray | null\n shouldEnsure?: boolean\n url?: string\n }): Promise\n protected abstract getPrerenderManifest(): DeepReadonly\n protected abstract getNextFontManifest():\n | DeepReadonly\n | undefined\n protected abstract attachRequestMeta(\n req: ServerRequest,\n parsedUrl: NextUrlWithParsedQuery\n ): void\n protected abstract hasPage(pathname: string): Promise\n\n protected abstract sendRenderResult(\n req: ServerRequest,\n res: ServerResponse,\n options: {\n result: RenderResult\n generateEtags: boolean\n poweredByHeader: boolean\n cacheControl: CacheControl | undefined\n }\n ): Promise\n\n protected abstract runApi(\n req: ServerRequest,\n res: ServerResponse,\n query: ParsedUrlQuery,\n match: PagesAPIRouteMatch\n ): Promise\n\n protected abstract renderHTML(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: LoadedRenderOpts\n ): Promise\n\n protected abstract getIncrementalCache(options: {\n requestHeaders: Record\n }): Promise\n\n protected abstract getResponseCache(options: {\n dev: boolean\n }): ResponseCacheBase\n\n protected getServerComponentsHmrCache():\n | ServerComponentsHmrCache\n | undefined {\n return this.nextConfig.experimental.serverComponentsHmrCache\n ? (globalThis as any).__serverComponentsHmrCache\n : undefined\n }\n\n protected abstract loadEnvConfig(params: {\n dev: boolean\n forceReload: boolean\n }): void\n\n // TODO-APP: (wyattjoh): Make protected again. Used for turbopack in route-resolver.ts right now.\n public readonly matchers: RouteMatcherManager\n protected readonly i18nProvider?: I18NProvider\n protected readonly localeNormalizer?: LocaleRouteNormalizer\n\n protected readonly normalizers: {\n readonly rsc: RSCPathnameNormalizer | undefined\n readonly prefetchRSC: PrefetchRSCPathnameNormalizer | undefined\n readonly segmentPrefetchRSC: SegmentPrefixRSCPathnameNormalizer | undefined\n readonly data: NextDataPathnameNormalizer | undefined\n }\n\n private readonly isAppPPREnabled: boolean\n private readonly isAppSegmentPrefetchEnabled: boolean\n\n /**\n * This is used to persist cache scopes across\n * prefetch -> full route requests for cache components\n * it's only fully used in dev\n */\n\n public constructor(options: ServerOptions) {\n const {\n dir = '.',\n quiet = false,\n conf,\n dev = false,\n minimalMode = false,\n hostname,\n port,\n experimentalTestProxy,\n } = options\n\n this.experimentalTestProxy = experimentalTestProxy\n this.serverOptions = options\n\n this.dir = path.resolve(/* turbopackIgnore: true */ dir)\n\n this.quiet = quiet\n this.loadEnvConfig({ dev, forceReload: false })\n\n // TODO: should conf be normalized to prevent missing\n // values from causing issues as this can be user provided\n this.nextConfig = conf as NextConfigComplete\n this.hostname = hostname\n if (this.hostname) {\n // we format the hostname so that it can be fetched\n this.fetchHostname = formatHostname(this.hostname)\n }\n this.port = port\n this.distDir = path.join(\n /* turbopackIgnore: true */ this.dir,\n this.nextConfig.distDir\n )\n this.publicDir = this.getPublicDir()\n this.hasStaticDir = !minimalMode && this.getHasStaticDir()\n\n this.i18nProvider = this.nextConfig.i18n?.locales\n ? new I18NProvider(this.nextConfig.i18n)\n : undefined\n\n // Configure the locale normalizer, it's used for routes inside `pages/`.\n this.localeNormalizer = this.i18nProvider\n ? new LocaleRouteNormalizer(this.i18nProvider)\n : undefined\n\n const { assetPrefix, generateEtags } = this.nextConfig\n\n this.buildId = this.getBuildId()\n // this is a hack to avoid Webpack knowing this is equal to this.minimalMode\n // because we replace this.minimalMode to true in production bundles.\n const minimalModeKey = 'minimalMode'\n this[minimalModeKey] =\n minimalMode || !!process.env.NEXT_PRIVATE_MINIMAL_MODE\n\n this.enabledDirectories = this.getEnabledDirectories(dev)\n\n this.isAppPPREnabled =\n this.enabledDirectories.app &&\n checkIsAppPPREnabled(this.nextConfig.experimental.ppr)\n\n this.isAppSegmentPrefetchEnabled =\n this.enabledDirectories.app &&\n this.nextConfig.experimental.clientSegmentCache === true\n\n this.normalizers = {\n // We should normalize the pathname from the RSC prefix only in minimal\n // mode as otherwise that route is not exposed external to the server as\n // we instead only rely on the headers.\n rsc:\n this.enabledDirectories.app && this.minimalMode\n ? new RSCPathnameNormalizer()\n : undefined,\n prefetchRSC:\n this.isAppPPREnabled && this.minimalMode\n ? new PrefetchRSCPathnameNormalizer()\n : undefined,\n segmentPrefetchRSC:\n this.isAppSegmentPrefetchEnabled && this.minimalMode\n ? new SegmentPrefixRSCPathnameNormalizer()\n : undefined,\n data: this.enabledDirectories.pages\n ? new NextDataPathnameNormalizer(this.buildId)\n : undefined,\n }\n\n this.nextFontManifest = this.getNextFontManifest()\n process.env.NEXT_DEPLOYMENT_ID = this.nextConfig.deploymentId || ''\n\n this.renderOpts = {\n dir: this.dir,\n supportsDynamicResponse: true,\n trailingSlash: this.nextConfig.trailingSlash,\n deploymentId: this.nextConfig.deploymentId,\n poweredByHeader: this.nextConfig.poweredByHeader,\n generateEtags,\n previewProps: this.getPrerenderManifest().preview,\n basePath: this.nextConfig.basePath,\n images: this.nextConfig.images,\n optimizeCss: this.nextConfig.experimental.optimizeCss,\n nextConfigOutput: this.nextConfig.output,\n nextScriptWorkers: this.nextConfig.experimental.nextScriptWorkers,\n disableOptimizedLoading:\n this.nextConfig.experimental.disableOptimizedLoading,\n domainLocales: this.nextConfig.i18n?.domains,\n distDir: this.distDir,\n serverComponents: this.enabledDirectories.app,\n cacheLifeProfiles: this.nextConfig.cacheLife,\n enableTainting: this.nextConfig.experimental.taint,\n crossOrigin: this.nextConfig.crossOrigin\n ? this.nextConfig.crossOrigin\n : undefined,\n largePageDataBytes: this.nextConfig.experimental.largePageDataBytes,\n\n isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile,\n // `htmlLimitedBots` is passed to server as serialized config in string format\n htmlLimitedBots: this.nextConfig.htmlLimitedBots,\n cacheComponents: this.nextConfig.cacheComponents ?? false,\n experimental: {\n expireTime: this.nextConfig.expireTime,\n staleTimes: this.nextConfig.experimental.staleTimes,\n clientTraceMetadata: this.nextConfig.experimental.clientTraceMetadata,\n clientSegmentCache:\n this.nextConfig.experimental.clientSegmentCache === 'client-only'\n ? 'client-only'\n : Boolean(this.nextConfig.experimental.clientSegmentCache),\n clientParamParsingOrigins:\n this.nextConfig.experimental.clientParamParsingOrigins,\n dynamicOnHover: this.nextConfig.experimental.dynamicOnHover ?? false,\n inlineCss: this.nextConfig.experimental.inlineCss ?? false,\n authInterrupts: !!this.nextConfig.experimental.authInterrupts,\n },\n onInstrumentationRequestError:\n this.instrumentationOnRequestError.bind(this),\n reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength,\n }\n\n this.pagesManifest = this.getPagesManifest()\n this.appPathsManifest = this.getAppPathsManifest()\n this.appPathRoutes = this.getAppPathRoutes()\n this.interceptionRoutePatterns = this.getinterceptionRoutePatterns()\n\n // Configure the routes.\n this.matchers = this.getRouteMatchers()\n\n // Start route compilation. We don't wait for the routes to finish loading\n // because we use the `waitTillReady` promise below in `handleRequest` to\n // wait. Also we can't `await` in the constructor.\n void this.matchers.reload()\n\n this.setAssetPrefix(assetPrefix)\n this.responseCache = this.getResponseCache({ dev })\n }\n\n protected reloadMatchers() {\n return this.matchers.reload()\n }\n\n private handleRSCRequest: RouteHandler = (\n req,\n _res,\n parsedUrl\n ) => {\n if (!parsedUrl.pathname) return false\n\n if (this.normalizers.segmentPrefetchRSC?.match(parsedUrl.pathname)) {\n const result = this.normalizers.segmentPrefetchRSC.extract(\n parsedUrl.pathname\n )\n if (!result) return false\n\n const { originalPathname, segmentPath } = result\n parsedUrl.pathname = originalPathname\n\n // Mark the request as a router prefetch request.\n req.headers[RSC_HEADER] = '1'\n req.headers[NEXT_ROUTER_PREFETCH_HEADER] = '1'\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER] = segmentPath\n\n addRequestMeta(req, 'isRSCRequest', true)\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n addRequestMeta(req, 'segmentPrefetchRSCRequest', segmentPath)\n } else if (this.normalizers.prefetchRSC?.match(parsedUrl.pathname)) {\n parsedUrl.pathname = this.normalizers.prefetchRSC.normalize(\n parsedUrl.pathname,\n true\n )\n\n // Mark the request as a router prefetch request.\n req.headers[RSC_HEADER] = '1'\n req.headers[NEXT_ROUTER_PREFETCH_HEADER] = '1'\n addRequestMeta(req, 'isRSCRequest', true)\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n } else if (this.normalizers.rsc?.match(parsedUrl.pathname)) {\n parsedUrl.pathname = this.normalizers.rsc.normalize(\n parsedUrl.pathname,\n true\n )\n\n // Mark the request as a RSC request.\n req.headers[RSC_HEADER] = '1'\n addRequestMeta(req, 'isRSCRequest', true)\n } else if (req.headers['x-now-route-matches']) {\n // If we didn't match, return with the flight headers stripped. If in\n // minimal mode we didn't match based on the path, this can't be a RSC\n // request. This is because Vercel only sends this header during\n // revalidation requests and we want the cache to instead depend on the\n // request path for flight information.\n stripFlightHeaders(req.headers)\n\n return false\n } else if (req.headers[RSC_HEADER] === '1') {\n addRequestMeta(req, 'isRSCRequest', true)\n\n if (req.headers[NEXT_ROUTER_PREFETCH_HEADER] === '1') {\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n\n const segmentPrefetchRSCRequest =\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]\n if (typeof segmentPrefetchRSCRequest === 'string') {\n addRequestMeta(\n req,\n 'segmentPrefetchRSCRequest',\n segmentPrefetchRSCRequest\n )\n }\n }\n } else {\n // Otherwise just return without doing anything.\n return false\n }\n\n if (req.url) {\n const parsed = parseUrl(req.url)\n parsed.pathname = parsedUrl.pathname\n req.url = formatUrl(parsed)\n }\n\n return false\n }\n\n private handleNextDataRequest: RouteHandler =\n async (req, res, parsedUrl) => {\n const middleware = await this.getMiddleware()\n const params = matchNextDataPathname(parsedUrl.pathname)\n\n // ignore for non-next data URLs\n if (!params || !params.path) {\n return false\n }\n\n if (params.path[0] !== this.buildId) {\n // Ignore if its a middleware request when we aren't on edge.\n if (getRequestMeta(req, 'middlewareInvoke')) {\n return false\n }\n\n // Make sure to 404 if the buildId isn't correct\n await this.render404(req, res, parsedUrl)\n return true\n }\n\n // remove buildId from URL\n params.path.shift()\n\n const lastParam = params.path[params.path.length - 1]\n\n // show 404 if it doesn't end with .json\n if (typeof lastParam !== 'string' || !lastParam.endsWith('.json')) {\n await this.render404(req, res, parsedUrl)\n return true\n }\n\n // re-create page's pathname\n let pathname = `/${params.path.join('/')}`\n pathname = getRouteFromAssetPath(pathname, '.json')\n\n // ensure trailing slash is normalized per config\n if (middleware) {\n if (this.nextConfig.trailingSlash && !pathname.endsWith('/')) {\n pathname += '/'\n }\n if (\n !this.nextConfig.trailingSlash &&\n pathname.length > 1 &&\n pathname.endsWith('/')\n ) {\n pathname = pathname.substring(0, pathname.length - 1)\n }\n }\n\n if (this.i18nProvider) {\n // Remove the port from the hostname if present.\n const hostname = req?.headers.host?.split(':', 1)[0].toLowerCase()\n\n const domainLocale = this.i18nProvider.detectDomainLocale(hostname)\n const defaultLocale =\n domainLocale?.defaultLocale ?? this.i18nProvider.config.defaultLocale\n\n const localePathResult = this.i18nProvider.analyze(pathname)\n\n // If the locale is detected from the path, we need to remove it\n // from the pathname.\n if (localePathResult.detectedLocale) {\n pathname = localePathResult.pathname\n }\n\n // Update the query with the detected locale and default locale.\n addRequestMeta(req, 'locale', localePathResult.detectedLocale)\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n\n // If the locale is not detected from the path, we need to mark that\n // it was not inferred from default.\n if (!localePathResult.detectedLocale) {\n removeRequestMeta(req, 'localeInferredFromDefault')\n }\n\n // If no locale was detected and we don't have middleware, we need\n // to render a 404 page.\n if (!localePathResult.detectedLocale && !middleware) {\n addRequestMeta(req, 'locale', defaultLocale)\n await this.render404(req, res, parsedUrl)\n return true\n }\n }\n\n parsedUrl.pathname = pathname\n addRequestMeta(req, 'isNextDataReq', true)\n\n return false\n }\n\n protected handleNextImageRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected handleCatchallRenderRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected handleCatchallMiddlewareRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected getRouteMatchers(): RouteMatcherManager {\n // Create a new manifest loader that get's the manifests from the server.\n const manifestLoader = new ServerManifestLoader((name) => {\n switch (name) {\n case PAGES_MANIFEST:\n return this.getPagesManifest() ?? null\n case APP_PATHS_MANIFEST:\n return this.getAppPathsManifest() ?? null\n default:\n return null\n }\n })\n\n // Configure the matchers and handlers.\n const matchers: RouteMatcherManager = new DefaultRouteMatcherManager()\n\n // Match pages under `pages/`.\n matchers.push(\n new PagesRouteMatcherProvider(\n this.distDir,\n manifestLoader,\n this.i18nProvider\n )\n )\n\n // Match api routes under `pages/api/`.\n matchers.push(\n new PagesAPIRouteMatcherProvider(\n this.distDir,\n manifestLoader,\n this.i18nProvider\n )\n )\n\n // If the app directory is enabled, then add the app matchers and handlers.\n if (this.enabledDirectories.app) {\n // Match app pages under `app/`.\n matchers.push(\n new AppPageRouteMatcherProvider(this.distDir, manifestLoader)\n )\n matchers.push(\n new AppRouteRouteMatcherProvider(this.distDir, manifestLoader)\n )\n }\n\n return matchers\n }\n\n protected async instrumentationOnRequestError(\n ...args: Parameters\n ) {\n const [err, req, ctx] = args\n\n if (this.instrumentation) {\n try {\n await this.instrumentation.onRequestError?.(\n err,\n {\n path: req.url || '',\n method: req.method || 'GET',\n // Normalize middleware headers and other server request headers\n headers:\n req instanceof NextRequestHint\n ? Object.fromEntries(req.headers.entries())\n : req.headers,\n },\n ctx\n )\n } catch (handlerErr) {\n // Log the soft error and continue, since errors can thrown from react stream handler\n console.error('Error in instrumentation.onRequestError:', handlerErr)\n }\n }\n }\n\n public logError(err: Error): void {\n if (this.quiet) return\n Log.error(err)\n }\n\n public async handleRequest(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery\n ): Promise {\n await this.prepare()\n const method = req.method.toUpperCase()\n const tracer = getTracer()\n\n return tracer.withPropagatedContext(req.headers, () => {\n return tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n async (span) =>\n this.handleRequestImpl(req, res, parsedUrl).finally(() => {\n if (!span) return\n\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': isRSCRequest,\n })\n\n if (res.statusCode && res.statusCode >= 500) {\n // For 5xx status codes: SHOULD be set to 'Error' span status.\n // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status\n span.setStatus({\n code: SpanStatusCode.ERROR,\n })\n // For span status 'Error', SHOULD set 'error.type' attribute.\n span.setAttribute('error.type', res.statusCode.toString())\n }\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) return\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = isRSCRequest\n ? `RSC ${method} ${route}`\n : `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(isRSCRequest ? `RSC ${method}` : `${method}`)\n }\n })\n )\n })\n }\n\n private async handleRequestImpl(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery\n ): Promise {\n try {\n // Wait for the matchers to be ready.\n await this.matchers.waitTillReady()\n\n // ensure cookies set in middleware are merged and\n // not overridden by API routes/getServerSideProps\n patchSetHeaderWithCookieSupport(\n req,\n isNodeNextResponse(res) ? res.originalResponse : res\n )\n\n const urlParts = (req.url || '').split('?', 1)\n const urlNoQuery = urlParts[0]\n\n // this normalizes repeated slashes in the path e.g. hello//world ->\n // hello/world or backslashes to forward slashes, this does not\n // handle trailing slash as that is handled the same as a next.config.js\n // redirect\n if (urlNoQuery?.match(/(\\\\|\\/\\/)/)) {\n const cleanUrl = normalizeRepeatedSlashes(req.url!)\n res.redirect(cleanUrl, 308).body(cleanUrl).send()\n return\n }\n\n // Parse url if parsedUrl not provided\n if (!parsedUrl || typeof parsedUrl !== 'object') {\n if (!req.url) {\n throw new Error('Invariant: url can not be undefined')\n }\n\n parsedUrl = parseUrl(req.url!, true)\n }\n\n if (!parsedUrl.pathname) {\n throw new Error(\"Invariant: pathname can't be empty\")\n }\n\n // Parse the querystring ourselves if the user doesn't handle querystring parsing\n if (typeof parsedUrl.query === 'string') {\n parsedUrl.query = Object.fromEntries(\n new URLSearchParams(parsedUrl.query)\n )\n }\n\n // Update the `x-forwarded-*` headers.\n const { originalRequest = null } = isNodeNextRequest(req) ? req : {}\n const xForwardedProto = originalRequest?.headers['x-forwarded-proto']\n const isHttps = xForwardedProto\n ? xForwardedProto === 'https'\n : !!(originalRequest?.socket as TLSSocket)?.encrypted\n\n req.headers['x-forwarded-host'] ??= req.headers['host'] ?? this.hostname\n req.headers['x-forwarded-port'] ??= this.port\n ? this.port.toString()\n : isHttps\n ? '443'\n : '80'\n req.headers['x-forwarded-proto'] ??= isHttps ? 'https' : 'http'\n req.headers['x-forwarded-for'] ??= originalRequest?.socket?.remoteAddress\n\n // This should be done before any normalization of the pathname happens as\n // it captures the initial URL.\n this.attachRequestMeta(req, parsedUrl)\n\n let finished = await this.handleRSCRequest(req, res, parsedUrl)\n if (finished) return\n\n const domainLocale = this.i18nProvider?.detectDomainLocale(\n getHostname(parsedUrl, req.headers)\n )\n\n const defaultLocale =\n domainLocale?.defaultLocale || this.nextConfig.i18n?.defaultLocale\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n\n const url = parseUrlUtil(req.url.replace(/^\\/+/, '/'))\n const pathnameInfo = getNextPathnameInfo(url.pathname, {\n nextConfig: this.nextConfig,\n i18nProvider: this.i18nProvider,\n })\n url.pathname = pathnameInfo.pathname\n\n if (pathnameInfo.basePath) {\n req.url = removePathPrefix(req.url!, this.nextConfig.basePath)\n }\n\n const useMatchedPathHeader =\n this.minimalMode && typeof req.headers[MATCHED_PATH_HEADER] === 'string'\n\n // TODO: merge handling with invokePath\n if (useMatchedPathHeader) {\n try {\n if (this.enabledDirectories.app) {\n // ensure /index path is normalized for prerender\n // in minimal mode\n if (req.url.match(/^\\/index($|\\?)/)) {\n req.url = req.url.replace(/^\\/index/, '/')\n }\n parsedUrl.pathname =\n parsedUrl.pathname === '/index' ? '/' : parsedUrl.pathname\n }\n\n // x-matched-path is the source of truth, it tells what page\n // should be rendered because we don't process rewrites in minimalMode\n let { pathname: matchedPath } = new URL(\n fixMojibake(req.headers[MATCHED_PATH_HEADER] as string),\n 'http://localhost'\n )\n\n let { pathname: urlPathname } = new URL(req.url, 'http://localhost')\n\n // For ISR the URL is normalized to the prerenderPath so if\n // it's a data request the URL path will be the data URL,\n // basePath is already stripped by this point\n if (this.normalizers.data?.match(urlPathname)) {\n addRequestMeta(req, 'isNextDataReq', true)\n }\n\n // It's important to execute the following block even it the request\n // matches a pages data route from above.\n if (\n this.isAppPPREnabled &&\n this.minimalMode &&\n req.headers[NEXT_RESUME_HEADER] === '1' &&\n req.method === 'POST'\n ) {\n // Decode the postponed state from the request body, it will come as\n // an array of buffers, so collect them and then concat them to form\n // the string.\n const body: Array = []\n for await (const chunk of req.body) {\n body.push(chunk)\n }\n const postponed = Buffer.concat(body).toString('utf8')\n\n addRequestMeta(req, 'postponed', postponed)\n }\n\n // If the request is a next data request and it has a postponed state,\n // we should error, as it represents an unprocessable request.\n if (\n getRequestMeta(req, 'isNextDataReq') &&\n getRequestMeta(req, 'postponed')\n ) {\n // The server understood that this is a PPR resume request, as the\n // headers were included to correctly indicate a resume request, but\n // because the request URL indicates that this should render a next\n // data route (a pages router route), this represents an\n // unprocessable request.\n res.statusCode = 422\n res.send()\n return\n }\n\n matchedPath = this.normalize(matchedPath)\n const normalizedUrlPath = this.stripNextDataPath(urlPathname)\n\n matchedPath = denormalizePagePath(matchedPath)\n\n // Perform locale detection and normalization.\n const localeAnalysisResult = this.i18nProvider?.analyze(matchedPath, {\n defaultLocale,\n })\n\n // The locale result will be defined even if the locale was not\n // detected for the request because it will be inferred from the\n // default locale.\n if (localeAnalysisResult) {\n addRequestMeta(req, 'locale', localeAnalysisResult.detectedLocale)\n\n // If the detected locale was inferred from the default locale, we\n // need to modify the metadata on the request to indicate that.\n if (localeAnalysisResult.inferredFromDefault) {\n addRequestMeta(req, 'localeInferredFromDefault', true)\n } else {\n removeRequestMeta(req, 'localeInferredFromDefault')\n }\n }\n\n let srcPathname = matchedPath\n let pageIsDynamic = isDynamicRoute(srcPathname)\n let paramsResult: {\n params: ParsedUrlQuery | false\n hasValidParams: boolean\n } = {\n params: false,\n hasValidParams: false,\n }\n\n const match = await this.matchers.match(srcPathname, {\n i18n: localeAnalysisResult,\n })\n\n if (!pageIsDynamic && match) {\n // Update the source pathname to the matched page's pathname.\n srcPathname = match.definition.pathname\n\n // The page is dynamic if the params are defined. We know at this\n // stage that the matched path is not a static page if the params\n // were parsed from the matched path header.\n if (typeof match.params !== 'undefined') {\n pageIsDynamic = true\n paramsResult.params = match.params\n paramsResult.hasValidParams = true\n }\n }\n\n // The rest of this function can't handle i18n properly, so ensure we\n // restore the pathname with the locale information stripped from it\n // now that we're done matching if we're using i18n.\n if (localeAnalysisResult) {\n matchedPath = localeAnalysisResult.pathname\n }\n\n const utils = getServerUtils({\n pageIsDynamic,\n page: srcPathname,\n i18n: this.nextConfig.i18n,\n basePath: this.nextConfig.basePath,\n rewrites: this.getRoutesManifest()?.rewrites || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n caseSensitive: !!this.nextConfig.experimental.caseSensitiveRoutes,\n })\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !pathnameInfo.locale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname}`\n }\n\n // Store a copy of `parsedUrl.query` before calling handleRewrites.\n // Since `handleRewrites` might add new queries to `parsedUrl.query`.\n const originQueryParams = { ...parsedUrl.query }\n\n const pathnameBeforeRewrite = parsedUrl.pathname\n const { rewriteParams, rewrittenParsedUrl } = utils.handleRewrites(\n req,\n parsedUrl\n )\n const rewriteParamKeys = Object.keys(rewriteParams)\n\n // Create a copy of the query params to avoid mutating the original\n // object. This prevents any overlapping query params that have the\n // same normalized key from causing issues.\n const rewrittenQueryParams = { ...rewrittenParsedUrl.query }\n const didRewrite =\n pathnameBeforeRewrite !== rewrittenParsedUrl.pathname\n\n if (didRewrite && rewrittenParsedUrl.pathname) {\n addRequestMeta(req, 'rewroteURL', rewrittenParsedUrl.pathname)\n }\n\n const routeParamKeys = new Set()\n for (const [key, value] of Object.entries(parsedUrl.query)) {\n const normalizedKey = normalizeNextQueryParam(key)\n if (!normalizedKey) continue\n\n // Remove the prefixed key from the query params because we want\n // to consume it for the dynamic route matcher.\n delete parsedUrl.query[key]\n routeParamKeys.add(normalizedKey)\n\n if (typeof value === 'undefined') continue\n\n rewrittenQueryParams[normalizedKey] = Array.isArray(value)\n ? value.map((v) => decodeQueryPathParameter(v))\n : decodeQueryPathParameter(value)\n }\n\n // interpolate dynamic params and normalize URL if needed\n if (pageIsDynamic) {\n let params: ParsedUrlQuery | false = {}\n\n // If we don't already have valid params, try to parse them from\n // the query params.\n if (!paramsResult.hasValidParams) {\n paramsResult = utils.normalizeDynamicRouteParams(\n rewrittenQueryParams,\n false\n )\n }\n\n // for prerendered ISR paths we attempt parsing the route\n // params from the URL directly as route-matches may not\n // contain the correct values due to the filesystem path\n // matching before the dynamic route has been matched\n if (\n !paramsResult.hasValidParams &&\n !isDynamicRoute(normalizedUrlPath)\n ) {\n let matcherParams = utils.dynamicRouteMatcher?.(normalizedUrlPath)\n\n if (matcherParams) {\n utils.normalizeDynamicRouteParams(matcherParams, false)\n Object.assign(paramsResult.params, matcherParams)\n paramsResult.hasValidParams = true\n }\n }\n\n // if an action request is bypassing a prerender and we\n // don't have the params in the URL since it was prerendered\n // and matched during handle: 'filesystem' rather than dynamic route\n // resolving we need to parse the params from the matched-path.\n // Note: this is similar to above case but from match-path instead\n // of from the request URL since a rewrite could cause that to not\n // match the src pathname\n if (\n // we can have a collision with /index and a top-level /[slug]\n matchedPath !== '/index' &&\n !paramsResult.hasValidParams &&\n !isDynamicRoute(matchedPath)\n ) {\n let matcherParams = utils.dynamicRouteMatcher?.(matchedPath)\n\n if (matcherParams) {\n const curParamsResult = utils.normalizeDynamicRouteParams(\n matcherParams,\n false\n )\n\n if (curParamsResult.hasValidParams) {\n Object.assign(params, matcherParams)\n paramsResult = curParamsResult\n }\n }\n }\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n\n const routeMatchesHeader = req.headers['x-now-route-matches']\n if (\n typeof routeMatchesHeader === 'string' &&\n routeMatchesHeader &&\n isDynamicRoute(matchedPath) &&\n !paramsResult.hasValidParams\n ) {\n const routeMatches =\n utils.getParamsFromRouteMatches(routeMatchesHeader)\n\n if (routeMatches) {\n paramsResult = utils.normalizeDynamicRouteParams(\n routeMatches,\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n }\n\n // Try to parse the params from the query if we couldn't parse them\n // from the route matches but ignore missing optional params.\n if (!paramsResult.hasValidParams) {\n paramsResult = utils.normalizeDynamicRouteParams(\n rewrittenQueryParams,\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // If the pathname being requested is the same as the source\n // pathname, and we don't have valid params, we want to use the\n // default route matches.\n if (\n utils.defaultRouteMatches &&\n normalizedUrlPath === srcPathname &&\n !paramsResult.hasValidParams\n ) {\n params = utils.defaultRouteMatches\n\n // If the route matches header is an empty string, we want to\n // render a fallback shell. This is because we know this came from\n // a prerender (it has the header) but it's values were filtered\n // out (because the allowQuery was empty). If it was undefined\n // then we know that the request is hitting the lambda directly.\n if (routeMatchesHeader === '') {\n addRequestMeta(req, 'renderFallbackShell', true)\n }\n }\n\n if (params) {\n matchedPath = utils.interpolateDynamicPath(srcPathname, params)\n req.url = utils.interpolateDynamicPath(req.url!, params)\n\n // If the request is for a segment prefetch, we need to update the\n // segment prefetch request path to include the interpolated\n // params.\n let segmentPrefetchRSCRequest = getRequestMeta(\n req,\n 'segmentPrefetchRSCRequest'\n )\n if (\n segmentPrefetchRSCRequest &&\n isDynamicRoute(segmentPrefetchRSCRequest, false)\n ) {\n segmentPrefetchRSCRequest = utils.interpolateDynamicPath(\n segmentPrefetchRSCRequest,\n params\n )\n\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER] =\n segmentPrefetchRSCRequest\n addRequestMeta(\n req,\n 'segmentPrefetchRSCRequest',\n segmentPrefetchRSCRequest\n )\n }\n }\n }\n\n if (pageIsDynamic || didRewrite) {\n utils.normalizeCdnUrl(req, [\n ...rewriteParamKeys,\n ...Object.keys(utils.defaultRouteRegex?.groups || {}),\n ])\n }\n\n // Remove the route `params` keys from `parsedUrl.query` if they are\n // not in the original query params.\n // If it's used in both route `params` and query `searchParams`, it should be kept.\n for (const key of routeParamKeys) {\n if (!(key in originQueryParams)) {\n delete parsedUrl.query[key]\n }\n }\n\n parsedUrl.pathname = matchedPath\n url.pathname = parsedUrl.pathname\n\n // For Pages Router routes, use the normalized queryParams from\n // handleRewrites to ensure catch-all routes get proper array values.\n // App Router routes should not include rewrite query params as they\n // affect RSC payload.\n if (\n match?.definition.kind === RouteKind.PAGES ||\n match?.definition.kind === RouteKind.PAGES_API\n ) {\n parsedUrl.query = rewrittenQueryParams\n }\n\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n } catch (err) {\n if (err instanceof DecodeError || err instanceof NormalizeError) {\n res.statusCode = 400\n return this.renderError(null, req, res, '/_error', {})\n }\n throw err\n }\n }\n\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n\n if (pathnameInfo.locale) {\n req.url = formatUrl(url)\n addRequestMeta(req, 'didStripLocale', true)\n }\n\n // If we aren't in minimal mode or there is no locale in the query\n // string, add the locale to the query string.\n if (!this.minimalMode || !getRequestMeta(req, 'locale')) {\n // If the locale is in the pathname, add it to the query string.\n if (pathnameInfo.locale) {\n addRequestMeta(req, 'locale', pathnameInfo.locale)\n }\n // If the default locale is available, add it to the query string and\n // mark it as inferred rather than implicit.\n else if (defaultLocale) {\n addRequestMeta(req, 'locale', defaultLocale)\n addRequestMeta(req, 'localeInferredFromDefault', true)\n }\n }\n\n // set incremental cache to request meta so it can\n // be passed down for edge functions and the fetch disk\n // cache can be leveraged locally\n if (\n !(this.serverOptions as any).webServerConfig &&\n !getRequestMeta(req, 'incrementalCache')\n ) {\n const incrementalCache = await this.getIncrementalCache({\n requestHeaders: Object.assign({}, req.headers),\n })\n\n incrementalCache.resetRequestCache()\n addRequestMeta(req, 'incrementalCache', incrementalCache)\n // This is needed for pages router to leverage unstable_cache\n // TODO: re-work this handling to not use global and use a AsyncStore\n ;(globalThis as any).__incrementalCache = incrementalCache\n }\n\n // set server components HMR cache to request meta so it can be passed\n // down for edge functions\n if (!getRequestMeta(req, 'serverComponentsHmrCache')) {\n addRequestMeta(\n req,\n 'serverComponentsHmrCache',\n this.getServerComponentsHmrCache()\n )\n }\n\n // when invokePath is specified we can short short circuit resolving\n // we only honor this header if we are inside of a render worker to\n // prevent external users coercing the routing path\n const invokePath = getRequestMeta(req, 'invokePath')\n const useInvokePath = !useMatchedPathHeader && invokePath\n\n if (useInvokePath) {\n const invokeStatus = getRequestMeta(req, 'invokeStatus')\n if (invokeStatus) {\n const invokeQuery = getRequestMeta(req, 'invokeQuery')\n\n if (invokeQuery) {\n Object.assign(parsedUrl.query, invokeQuery)\n }\n\n res.statusCode = invokeStatus\n let err: Error | null = getRequestMeta(req, 'invokeError') || null\n\n return this.renderError(err, req, res, '/_error', parsedUrl.query)\n }\n\n const parsedMatchedPath = new URL(invokePath || '/', 'http://n')\n const invokePathnameInfo = getNextPathnameInfo(\n parsedMatchedPath.pathname,\n {\n nextConfig: this.nextConfig,\n parseData: false,\n }\n )\n\n if (invokePathnameInfo.locale) {\n addRequestMeta(req, 'locale', invokePathnameInfo.locale)\n }\n\n if (parsedUrl.pathname !== parsedMatchedPath.pathname) {\n parsedUrl.pathname = parsedMatchedPath.pathname\n addRequestMeta(req, 'rewroteURL', invokePathnameInfo.pathname)\n }\n const normalizeResult = normalizeLocalePath(\n removePathPrefix(parsedUrl.pathname, this.nextConfig.basePath || ''),\n this.nextConfig.i18n?.locales\n )\n\n if (normalizeResult.detectedLocale) {\n addRequestMeta(req, 'locale', normalizeResult.detectedLocale)\n }\n parsedUrl.pathname = normalizeResult.pathname\n\n for (const key of Object.keys(parsedUrl.query)) {\n delete parsedUrl.query[key]\n }\n const invokeQuery = getRequestMeta(req, 'invokeQuery')\n\n if (invokeQuery) {\n Object.assign(parsedUrl.query, invokeQuery)\n }\n\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n\n await this.handleCatchallRenderRequest(req, res, parsedUrl)\n return\n }\n\n if (getRequestMeta(req, 'middlewareInvoke')) {\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n\n finished = await this.handleCatchallMiddlewareRequest(\n req,\n res,\n parsedUrl\n )\n if (finished) return\n\n const err = new Error()\n ;(err as any).result = {\n response: new Response(null, {\n headers: {\n 'x-middleware-next': '1',\n },\n }),\n }\n ;(err as any).bubble = true\n throw err\n }\n\n // This wasn't a request via the matched path or the invoke path, so\n // prepare for a legacy run by removing the base path.\n\n // ensure we strip the basePath when not using an invoke header\n if (!useMatchedPathHeader && pathnameInfo.basePath) {\n parsedUrl.pathname = removePathPrefix(\n parsedUrl.pathname,\n pathnameInfo.basePath\n )\n }\n\n res.statusCode = 200\n return await this.run(req, res, parsedUrl)\n } catch (err: any) {\n if (err instanceof NoFallbackError) {\n throw err\n }\n\n if (\n (err && typeof err === 'object' && err.code === 'ERR_INVALID_URL') ||\n err instanceof DecodeError ||\n err instanceof NormalizeError\n ) {\n res.statusCode = 400\n return this.renderError(null, req, res, '/_error', {})\n }\n\n if (\n this.minimalMode ||\n this.renderOpts.dev ||\n (isBubbledError(err) && err.bubble)\n ) {\n throw err\n }\n this.logError(getProperError(err))\n res.statusCode = 500\n res.body('Internal Server Error').send()\n }\n }\n\n /**\n * Normalizes a pathname without attaching any metadata from any matched\n * normalizer.\n *\n * @param pathname the pathname to normalize\n * @returns the normalized pathname\n */\n private normalize = (pathname: string) => {\n const normalizers: Array = []\n\n if (this.normalizers.data) {\n normalizers.push(this.normalizers.data)\n }\n\n // We have to put the segment prefetch normalizer before the RSC normalizer\n // because the RSC normalizer will match the prefetch RSC routes too.\n if (this.normalizers.segmentPrefetchRSC) {\n normalizers.push(this.normalizers.segmentPrefetchRSC)\n }\n\n // We have to put the prefetch normalizer before the RSC normalizer\n // because the RSC normalizer will match the prefetch RSC routes too.\n if (this.normalizers.prefetchRSC) {\n normalizers.push(this.normalizers.prefetchRSC)\n }\n\n if (this.normalizers.rsc) {\n normalizers.push(this.normalizers.rsc)\n }\n\n for (const normalizer of normalizers) {\n if (!normalizer.match(pathname)) continue\n\n return normalizer.normalize(pathname, true)\n }\n\n return pathname\n }\n\n private normalizeAndAttachMetadata: RouteHandler<\n ServerRequest,\n ServerResponse\n > = async (req, res, url) => {\n let finished = await this.handleNextImageRequest(req, res, url)\n if (finished) return true\n\n if (this.enabledDirectories.pages) {\n finished = await this.handleNextDataRequest(req, res, url)\n if (finished) return true\n }\n\n return false\n }\n\n /**\n * @internal - this method is internal to Next.js and should not be used directly by end-users\n */\n public getRequestHandlerWithMetadata(\n meta: RequestMeta\n ): BaseRequestHandler {\n const handler = this.getRequestHandler()\n return (req, res, parsedUrl) => {\n setRequestMeta(req, meta)\n return handler(req, res, parsedUrl)\n }\n }\n\n public getRequestHandler(): BaseRequestHandler<\n ServerRequest,\n ServerResponse\n > {\n return this.handleRequest.bind(this)\n }\n\n protected abstract handleUpgrade(\n req: ServerRequest,\n socket: any,\n head?: any\n ): Promise\n\n public setAssetPrefix(prefix?: string): void {\n this.nextConfig.assetPrefix = prefix ? prefix.replace(/\\/$/, '') : ''\n }\n\n protected prepared: boolean = false\n protected preparedPromise: Promise | null = null\n /**\n * Runs async initialization of server.\n * It is idempotent, won't fire underlying initialization more than once.\n */\n public async prepare(): Promise {\n if (this.prepared) return\n\n // Get instrumentation module\n if (!this.instrumentation) {\n this.instrumentation = await this.loadInstrumentationModule()\n }\n if (this.preparedPromise === null) {\n this.preparedPromise = this.prepareImpl().then(() => {\n this.prepared = true\n this.preparedPromise = null\n })\n }\n return this.preparedPromise\n }\n protected async prepareImpl(): Promise {}\n protected async loadInstrumentationModule(): Promise {}\n\n public async close(): Promise {}\n\n protected getAppPathRoutes(): Record {\n const appPathRoutes: Record = {}\n\n Object.keys(this.appPathsManifest || {}).forEach((entry) => {\n const normalizedPath = normalizeAppPath(entry)\n if (!appPathRoutes[normalizedPath]) {\n appPathRoutes[normalizedPath] = []\n }\n appPathRoutes[normalizedPath].push(entry)\n })\n return appPathRoutes\n }\n\n protected async run(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise {\n return getTracer().trace(BaseServerSpan.run, async () =>\n this.runImpl(req, res, parsedUrl)\n )\n }\n\n private async runImpl(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise {\n await this.handleCatchallRenderRequest(req, res, parsedUrl)\n }\n\n private async pipe(\n fn: (\n ctx: RequestContext\n ) => Promise,\n partialContext: Omit<\n RequestContext,\n 'renderOpts'\n >\n ): Promise {\n return getTracer().trace(BaseServerSpan.pipe, async () =>\n this.pipeImpl(fn, partialContext)\n )\n }\n\n private async pipeImpl(\n fn: (\n ctx: RequestContext\n ) => Promise,\n partialContext: Omit<\n RequestContext,\n 'renderOpts'\n >\n ): Promise {\n const ua = partialContext.req.headers['user-agent'] || ''\n\n const ctx: RequestContext = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n // `renderOpts.botType` is accumulated in `this.renderImpl()`\n supportsDynamicResponse: !this.renderOpts.botType,\n serveStreamingMetadata: shouldServeStreamingMetadata(\n ua,\n this.nextConfig.htmlLimitedBots\n ),\n },\n }\n\n const payload = await fn(ctx)\n if (payload === null) {\n return\n }\n const { req, res } = ctx\n const originalStatus = res.statusCode\n const { body } = payload\n let { cacheControl } = payload\n if (!res.sent) {\n const { generateEtags, poweredByHeader, dev } = this.renderOpts\n\n // In dev, we should not cache pages for any reason.\n if (dev) {\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n cacheControl = undefined\n }\n\n if (cacheControl && cacheControl.expire === undefined) {\n cacheControl.expire = this.nextConfig.expireTime\n }\n\n await this.sendRenderResult(req, res, {\n result: body,\n generateEtags,\n poweredByHeader,\n cacheControl,\n })\n res.statusCode = originalStatus\n }\n }\n\n private async getStaticHTML(\n fn: (\n ctx: RequestContext\n ) => Promise,\n partialContext: Omit<\n RequestContext,\n 'renderOpts'\n >\n ): Promise {\n const ctx: RequestContext = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n supportsDynamicResponse: false,\n },\n }\n const payload = await fn(ctx)\n if (payload === null) {\n return null\n }\n return payload.body.toUnchunkedString()\n }\n\n public async render(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n parsedUrl?: NextUrlWithParsedQuery,\n internalRender = false\n ): Promise {\n return getTracer().trace(BaseServerSpan.render, async () =>\n this.renderImpl(req, res, pathname, query, parsedUrl, internalRender)\n )\n }\n\n protected getWaitUntil(): WaitUntil | undefined {\n const builtinRequestContext = getBuiltinRequestContext()\n if (builtinRequestContext) {\n // the platform provided a request context.\n // use the `waitUntil` from there, whether actually present or not --\n // if not present, `after` will error.\n\n // NOTE: if we're in an edge runtime sandbox, this context will be used to forward the outer waitUntil.\n return builtinRequestContext.waitUntil\n }\n\n if (this.minimalMode) {\n // we're built for a serverless environment, and `waitUntil` is not available,\n // but using a noop would likely lead to incorrect behavior,\n // because we have no way of keeping the invocation alive.\n // return nothing, and `after` will error if used.\n //\n // NOTE: for edge functions, `NextWebServer` always runs in minimal mode.\n //\n // NOTE: if we're in an edge runtime sandbox, waitUntil will be passed in using \"@next/request-context\",\n // so we won't get here.\n return undefined\n }\n\n return this.getInternalWaitUntil()\n }\n\n protected getInternalWaitUntil(): WaitUntil | undefined {\n return undefined\n }\n\n private async renderImpl(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n parsedUrl?: NextUrlWithParsedQuery,\n internalRender = false\n ): Promise {\n if (!pathname.startsWith('/')) {\n console.warn(\n `Cannot render page with path \"${pathname}\", did you mean \"/${pathname}\"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash`\n )\n }\n\n if (\n this.serverOptions.customServer &&\n pathname === '/index' &&\n !(await this.hasPage('/index'))\n ) {\n // maintain backwards compatibility for custom server\n // (see custom-server integration tests)\n pathname = '/'\n }\n\n const ua = req.headers['user-agent'] || ''\n this.renderOpts.botType = getBotType(ua)\n\n // we allow custom servers to call render for all URLs\n // so check if we need to serve a static _next file or not.\n // we don't modify the URL for _next/data request but still\n // call render so we special case this to prevent an infinite loop\n if (\n !internalRender &&\n !this.minimalMode &&\n !getRequestMeta(req, 'isNextDataReq') &&\n (req.url?.match(/^\\/_next\\//) ||\n (this.hasStaticDir && req.url!.match(/^\\/static\\//)))\n ) {\n return this.handleRequest(req, res, parsedUrl)\n }\n\n if (isBlockedPage(pathname)) {\n return this.render404(req, res, parsedUrl)\n }\n\n return this.pipe((ctx) => this.renderToResponse(ctx), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n protected async getStaticPaths({\n pathname,\n }: {\n pathname: string\n urlPathname: string\n requestHeaders: import('./lib/incremental-cache').IncrementalCache['requestHeaders']\n page: string\n isAppPath: boolean\n }): Promise<{\n staticPaths?: string[]\n prerenderedRoutes?: PrerenderedRoute[]\n fallbackMode?: FallbackMode\n }> {\n // Read whether or not fallback should exist from the manifest.\n const fallbackField =\n this.getPrerenderManifest().dynamicRoutes[pathname]?.fallback\n\n return {\n // `staticPaths` is intentionally set to `undefined` as it should've\n // been caught when checking disk data.\n staticPaths: undefined,\n fallbackMode: parseFallbackField(fallbackField),\n }\n }\n\n private async renderToResponseWithComponents(\n requestContext: RequestContext,\n findComponentsResult: FindComponentsResult\n ): Promise {\n return getTracer().trace(\n BaseServerSpan.renderToResponseWithComponents,\n async () =>\n this.renderToResponseWithComponentsImpl(\n requestContext,\n findComponentsResult\n )\n )\n }\n\n protected pathCouldBeIntercepted(resolvedPathname: string): boolean {\n return (\n isInterceptionRouteAppPath(resolvedPathname) ||\n this.interceptionRoutePatterns.some((regexp) => {\n return regexp.test(resolvedPathname)\n })\n )\n }\n\n protected setVaryHeader(\n req: ServerRequest,\n res: ServerResponse,\n isAppPath: boolean,\n resolvedPathname: string\n ): void {\n const baseVaryHeader = `${RSC_HEADER}, ${NEXT_ROUTER_STATE_TREE_HEADER}, ${NEXT_ROUTER_PREFETCH_HEADER}, ${NEXT_ROUTER_SEGMENT_PREFETCH_HEADER}`\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n\n let addedNextUrlToVary = false\n\n if (isAppPath && this.pathCouldBeIntercepted(resolvedPathname)) {\n // Interception route responses can vary based on the `Next-URL` header.\n // We use the Vary header to signal this behavior to the client to properly cache the response.\n res.appendHeader('vary', `${baseVaryHeader}, ${NEXT_URL}`)\n addedNextUrlToVary = true\n } else if (isAppPath || isRSCRequest) {\n // We don't need to include `Next-URL` in the Vary header for non-interception routes since it won't affect the response.\n // We also set this header for pages to avoid caching issues when navigating between pages and app.\n res.appendHeader('vary', baseVaryHeader)\n }\n\n if (!addedNextUrlToVary) {\n // Remove `Next-URL` from the request headers we determined it wasn't necessary to include in the Vary header.\n // This is to avoid any dependency on the `Next-URL` header being present when preparing the response.\n delete req.headers[NEXT_URL]\n }\n }\n\n private async renderToResponseWithComponentsImpl(\n {\n req,\n res,\n pathname,\n renderOpts: opts,\n }: RequestContext,\n { components, query }: FindComponentsResult\n ): Promise {\n if (pathname === UNDERSCORE_NOT_FOUND_ROUTE) {\n pathname = '/404'\n }\n const isErrorPathname = pathname === '/_error'\n const is404Page =\n pathname === '/404' || (isErrorPathname && res.statusCode === 404)\n const is500Page =\n pathname === '/500' || (isErrorPathname && res.statusCode === 500)\n const isAppPath = components.isAppPath === true\n\n const hasServerProps = !!components.getServerSideProps\n const isPossibleServerAction = getIsPossibleServerAction(req)\n let isSSG = !!components.getStaticProps\n // NOTE: Don't delete headers[RSC] yet, it still needs to be used in renderToHTML later\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n\n // Not all CDNs respect the Vary header when caching. We must assume that\n // only the URL is used to vary the responses. The Next client computes a\n // hash of the header values and sends it as a search param. Before\n // responding to a request, we must verify that the hash matches the\n // expected value. Neglecting to do this properly can lead to cache\n // poisoning attacks on certain CDNs.\n if (\n !this.minimalMode &&\n this.nextConfig.experimental.validateRSCRequestHeaders &&\n isRSCRequest &&\n // In the event that we're serving a NoFallbackError, the headers will\n // already be stripped so this comparison will always fail, resulting in\n // a redirect loop.\n !is404Page\n ) {\n const headers = req.headers\n\n const prefetchHeaderValue = headers[NEXT_ROUTER_PREFETCH_HEADER]\n const routerPrefetch =\n prefetchHeaderValue !== undefined\n ? // We only recognize '1' and '2'. Strip all other values here.\n prefetchHeaderValue === '1' || prefetchHeaderValue === '2'\n ? prefetchHeaderValue\n : undefined\n : // For runtime prefetches, we always perform a dynamic request,\n // so we don't expect the header to be stripped by an intermediate layer.\n // This should only happen for static prefetches, so we only handle those here.\n getRequestMeta(req, 'isPrefetchRSCRequest')\n ? '1'\n : undefined\n\n const segmentPrefetchRSCRequest =\n headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER] ||\n getRequestMeta(req, 'segmentPrefetchRSCRequest')\n\n const expectedHash = computeCacheBustingSearchParam(\n routerPrefetch,\n segmentPrefetchRSCRequest,\n headers[NEXT_ROUTER_STATE_TREE_HEADER],\n headers[NEXT_URL]\n )\n const actualHash =\n getRequestMeta(req, 'cacheBustingSearchParam') ??\n new URL(req.url || '', 'http://localhost').searchParams.get(\n NEXT_RSC_UNION_QUERY\n )\n\n if (expectedHash !== actualHash) {\n // The hash sent by the client does not match the expected value.\n // Redirect to the URL with the correct cache-busting search param.\n // This prevents cache poisoning attacks on CDNs that don't respect Vary headers.\n // Note: When no headers are present, expectedHash is empty string and client\n // must send `_rsc` param, otherwise actualHash is null and hash check fails.\n const url = new URL(req.url || '', 'http://localhost')\n setCacheBustingSearchParamWithHash(url, expectedHash)\n res.statusCode = 307\n res.setHeader('location', `${url.pathname}${url.search}`)\n res.body('').send()\n return null\n }\n }\n\n // Compute the iSSG cache key. We use the rewroteUrl since\n // pages with fallback: false are allowed to be rewritten to\n // and we need to look up the path by the rewritten path\n let urlPathname = parseUrl(req.url || '').pathname || '/'\n\n let resolvedUrlPathname = getRequestMeta(req, 'rewroteURL') || urlPathname\n\n this.setVaryHeader(req, res, isAppPath, resolvedUrlPathname)\n\n let staticPaths: string[] | undefined\n let hasFallback = false\n\n const prerenderManifest = this.getPrerenderManifest()\n\n if (\n hasFallback ||\n staticPaths?.includes(resolvedUrlPathname) ||\n // this signals revalidation in deploy environments\n // TODO: make this more generic\n req.headers['x-now-route-matches']\n ) {\n isSSG = true\n } else if (!this.renderOpts.dev) {\n isSSG ||= !!prerenderManifest.routes[toRoute(pathname)]\n }\n\n // Toggle whether or not this is a Data request\n const isNextDataRequest =\n !!(\n getRequestMeta(req, 'isNextDataReq') ||\n (req.headers['x-nextjs-data'] &&\n (this.serverOptions as any).webServerConfig)\n ) &&\n (isSSG || hasServerProps)\n\n // when we are handling a middleware prefetch and it doesn't\n // resolve to a static data route we bail early to avoid\n // unexpected SSR invocations\n if (\n !isSSG &&\n req.headers['x-middleware-prefetch'] &&\n !(is404Page || pathname === '/_error')\n ) {\n res.setHeader(MATCHED_PATH_HEADER, pathname)\n res.setHeader('x-middleware-skip', '1')\n res.setHeader(\n 'cache-control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n res.body('{}').send()\n return null\n }\n\n // normalize req.url for SSG paths as it is not exposed\n // to getStaticProps and the asPath should not expose /_next/data\n if (\n isSSG &&\n this.minimalMode &&\n req.headers[MATCHED_PATH_HEADER] &&\n req.url.startsWith('/_next/data')\n ) {\n req.url = this.stripNextDataPath(req.url)\n }\n\n const locale = getRequestMeta(req, 'locale')\n\n if (\n !!req.headers['x-nextjs-data'] &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n `${locale ? `/${locale}` : ''}${pathname}`\n )\n }\n\n let routeModule: RouteModule | undefined\n if (components.routeModule) {\n routeModule = components.routeModule\n }\n\n /**\n * If the route being rendered is an app page, and the ppr feature has been\n * enabled, then the given route _could_ support PPR.\n */\n const couldSupportPPR: boolean =\n this.isAppPPREnabled &&\n typeof routeModule !== 'undefined' &&\n isAppPageRouteModule(routeModule)\n\n // When enabled, this will allow the use of the `?__nextppronly` query to\n // enable debugging of the static shell.\n const hasDebugStaticShellQuery =\n process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING === '1' &&\n typeof query.__nextppronly !== 'undefined' &&\n couldSupportPPR\n\n // This page supports PPR if it is marked as being `PARTIALLY_STATIC` in the\n // prerender manifest and this is an app page.\n const isRoutePPREnabled: boolean =\n couldSupportPPR &&\n ((\n prerenderManifest.routes[pathname] ??\n prerenderManifest.dynamicRoutes[pathname]\n )?.renderingMode === 'PARTIALLY_STATIC' ||\n // Ideally we'd want to check the appConfig to see if this page has PPR\n // enabled or not, but that would require plumbing the appConfig through\n // to the server during development. We assume that the page supports it\n // but only during development.\n (hasDebugStaticShellQuery &&\n (this.renderOpts.dev === true ||\n this.experimentalTestProxy === true)))\n\n // If we're in minimal mode, then try to get the postponed information from\n // the request metadata. If available, use it for resuming the postponed\n // render.\n const minimalPostponed = isRoutePPREnabled\n ? getRequestMeta(req, 'postponed')\n : undefined\n\n // we need to ensure the status code if /404 is visited directly\n if (is404Page && !isNextDataRequest && !isRSCRequest) {\n res.statusCode = 404\n }\n\n // ensure correct status is set when visiting a status page\n // directly e.g. /500\n if (STATIC_STATUS_PAGES.includes(pathname)) {\n res.statusCode = parseInt(pathname.slice(1), 10)\n }\n\n if (\n // Server actions can use non-GET/HEAD methods.\n !isPossibleServerAction &&\n // Resume can use non-GET/HEAD methods.\n !minimalPostponed &&\n !is404Page &&\n !is500Page &&\n pathname !== '/_error' &&\n req.method !== 'HEAD' &&\n req.method !== 'GET' &&\n (typeof components.Component === 'string' || isSSG)\n ) {\n res.statusCode = 405\n res.setHeader('Allow', ['GET', 'HEAD'])\n res.body('Method Not Allowed').send()\n return null\n }\n\n // handle static page\n if (typeof components.Component === 'string') {\n return {\n body: RenderResult.fromStatic(\n components.Component,\n HTML_CONTENT_TYPE_HEADER\n ),\n }\n }\n\n if (opts.supportsDynamicResponse === true) {\n const ua = req.headers['user-agent'] || ''\n const isBotRequest = isBot(ua)\n const isSupportedDocument =\n typeof components.Document?.getInitialProps !== 'function' ||\n // The built-in `Document` component also supports dynamic HTML for concurrent mode.\n NEXT_BUILTIN_DOCUMENT in components.Document\n\n // Disable dynamic HTML in cases that we know it won't be generated,\n // so that we can continue generating a cache key when possible.\n // TODO-APP: should the first render for a dynamic app path\n // be static so we can collect revalidate and populate the\n // cache if there are no dynamic data requirements\n opts.supportsDynamicResponse =\n !isSSG && !isBotRequest && isSupportedDocument\n }\n\n // In development, we always want to generate dynamic HTML.\n if (!isNextDataRequest && isAppPath && opts.dev) {\n opts.supportsDynamicResponse = true\n }\n\n if (isSSG && this.minimalMode && req.headers[MATCHED_PATH_HEADER]) {\n // the url value is already correct when the matched-path header is set\n resolvedUrlPathname = urlPathname\n }\n\n urlPathname = removeTrailingSlash(urlPathname)\n resolvedUrlPathname = removeTrailingSlash(resolvedUrlPathname)\n if (this.localeNormalizer) {\n resolvedUrlPathname = this.localeNormalizer.normalize(resolvedUrlPathname)\n }\n\n // remove /_next/data prefix from urlPathname so it matches\n // for direct page visit and /_next/data visit\n if (isNextDataRequest) {\n resolvedUrlPathname = this.stripNextDataPath(resolvedUrlPathname)\n urlPathname = this.stripNextDataPath(urlPathname)\n }\n\n // use existing incrementalCache instance if available\n const incrementalCache: import('./lib/incremental-cache').IncrementalCache =\n await this.getIncrementalCache({\n requestHeaders: Object.assign({}, req.headers),\n })\n\n // TODO: investigate, this is not safe across multiple concurrent requests\n incrementalCache.resetRequestCache()\n\n if (\n routeModule?.isDev &&\n isDynamicRoute(pathname) &&\n (components.getStaticPaths || isAppPath)\n ) {\n const pathsResults = await this.getStaticPaths({\n pathname,\n urlPathname,\n requestHeaders: req.headers,\n page: components.page,\n isAppPath,\n })\n if (isAppPath && this.nextConfig.cacheComponents) {\n if (pathsResults.prerenderedRoutes?.length) {\n let smallestFallbackRouteParams = null\n for (const route of pathsResults.prerenderedRoutes) {\n const fallbackRouteParams = route.fallbackRouteParams\n if (!fallbackRouteParams || fallbackRouteParams.length === 0) {\n // There are no fallback route params so we don't need to continue\n smallestFallbackRouteParams = null\n break\n }\n if (\n smallestFallbackRouteParams === null ||\n fallbackRouteParams.length < smallestFallbackRouteParams.length\n ) {\n smallestFallbackRouteParams = fallbackRouteParams\n }\n }\n if (smallestFallbackRouteParams) {\n addRequestMeta(\n req,\n 'devValidatingFallbackParams',\n createOpaqueFallbackRouteParams(smallestFallbackRouteParams)!\n )\n }\n }\n }\n }\n\n // An OPTIONS request to a page handler is invalid.\n if (\n req.method === 'OPTIONS' &&\n !is404Page &&\n (!routeModule || !isAppRouteRouteModule(routeModule))\n ) {\n await sendResponse(req, res, new Response(null, { status: 400 }))\n return null\n }\n\n const request = isNodeNextRequest(req) ? req.originalRequest : req\n const response = isNodeNextResponse(res) ? res.originalResponse : res\n\n const parsedInitUrl = parseUrl(getRequestMeta(req, 'initURL') || req.url)\n let initPathname = parsedInitUrl.pathname || '/'\n\n for (const normalizer of [\n this.normalizers.segmentPrefetchRSC,\n this.normalizers.prefetchRSC,\n this.normalizers.rsc,\n ]) {\n if (normalizer?.match(initPathname)) {\n initPathname = normalizer.normalize(initPathname)\n }\n }\n\n // On minimal mode, the request url of dynamic route can be a\n // literal dynamic route ('/[slug]') instead of actual URL, so overwriting to initPathname\n // will transform back the resolved url to the dynamic route pathname.\n if (!(this.minimalMode && isErrorPathname)) {\n request.url = `${initPathname}${parsedInitUrl.search || ''}`\n }\n\n // propagate the request context for dev\n setRequestMeta(request, getRequestMeta(req))\n addRequestMeta(request, 'distDir', this.distDir)\n addRequestMeta(request, 'query', query)\n addRequestMeta(request, 'params', opts.params)\n addRequestMeta(request, 'minimalMode', this.minimalMode)\n\n if (opts.err) {\n addRequestMeta(request, 'invokeError', opts.err)\n }\n\n const handler: (\n req: ServerRequest | IncomingMessage,\n res: ServerResponse | HTTPServerResponse,\n ctx: {\n waitUntil: ReturnType\n }\n ) => Promise = components.ComponentMod.handler\n\n const maybeDevRequest =\n // we need to capture fetch metrics when they are set\n // and can't wait for handler to resolve as the fetch\n // metrics are logged on response close which happens\n // before handler resolves\n process.env.NODE_ENV === 'development'\n ? new Proxy(request, {\n get(target: any, prop) {\n if (typeof target[prop] === 'function') {\n return target[prop].bind(target)\n }\n return target[prop]\n },\n set(target: any, prop, value) {\n if (prop === 'fetchMetrics') {\n ;(req as any).fetchMetrics = value\n }\n target[prop] = value\n return true\n },\n })\n : request\n\n await handler(maybeDevRequest, response, {\n waitUntil: this.getWaitUntil(),\n })\n\n // response is handled fully in handler\n return null\n }\n\n private stripNextDataPath(filePath: string, stripLocale = true) {\n if (filePath.includes(this.buildId)) {\n const splitPath = filePath.substring(\n filePath.indexOf(this.buildId) + this.buildId.length\n )\n\n filePath = denormalizePagePath(splitPath.replace(/\\.json$/, ''))\n }\n\n if (this.localeNormalizer && stripLocale) {\n return this.localeNormalizer.normalize(filePath)\n }\n return filePath\n }\n\n // map the route to the actual bundle name\n protected getOriginalAppPaths(route: string) {\n if (this.enabledDirectories.app) {\n const originalAppPath = this.appPathRoutes?.[route]\n\n if (!originalAppPath) {\n return null\n }\n\n return originalAppPath\n }\n return null\n }\n\n protected async renderPageComponent(\n ctx: RequestContext,\n bubbleNoFallback: boolean\n ) {\n const { query, pathname } = ctx\n\n const appPaths = this.getOriginalAppPaths(pathname)\n const isAppPath = Array.isArray(appPaths)\n\n let page = pathname\n if (isAppPath) {\n // the last item in the array is the root page, if there are parallel routes\n page = appPaths[appPaths.length - 1]\n }\n\n const result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page,\n query,\n params: ctx.renderOpts.params || {},\n isAppPath,\n sriEnabled: !!this.nextConfig.experimental.sri?.algorithm,\n appPaths,\n // Ensuring for loading page component routes is done via the matcher.\n shouldEnsure: false,\n })\n if (result) {\n getTracer().setRootSpanAttribute('next.route', pathname)\n try {\n return await this.renderToResponseWithComponents(ctx, result)\n } catch (err) {\n const isNoFallbackError = err instanceof NoFallbackError\n\n if (!isNoFallbackError || (isNoFallbackError && bubbleNoFallback)) {\n throw err\n }\n }\n }\n return false\n }\n\n private async renderToResponse(\n ctx: RequestContext\n ): Promise {\n return getTracer().trace(\n BaseServerSpan.renderToResponse,\n {\n spanName: `rendering page`,\n attributes: {\n 'next.route': ctx.pathname,\n },\n },\n async () => {\n return this.renderToResponseImpl(ctx)\n }\n )\n }\n\n protected abstract getMiddleware(): Promise\n protected abstract getFallbackErrorComponents(\n url?: string\n ): Promise\n protected abstract getRoutesManifest(): NormalizedRouteManifest | undefined\n\n private async renderToResponseImpl(\n ctx: RequestContext\n ): Promise {\n const { req, res, query, pathname } = ctx\n let page = pathname\n const bubbleNoFallback =\n getRequestMeta(ctx.req, 'bubbleNoFallback') ?? false\n\n if (\n !this.minimalMode &&\n this.nextConfig.experimental.validateRSCRequestHeaders\n ) {\n addRequestMeta(\n ctx.req,\n 'cacheBustingSearchParam',\n query[NEXT_RSC_UNION_QUERY]\n )\n }\n delete query[NEXT_RSC_UNION_QUERY]\n\n const options: MatchOptions = {\n i18n: this.i18nProvider?.fromRequest(req, pathname),\n }\n\n const existingMatch = getRequestMeta(ctx.req, 'match')\n\n let fastPath = true\n // when a specific invoke-output is meant to be matched\n // ensure a prior dynamic route/page doesn't take priority\n const invokeOutput = getRequestMeta(ctx.req, 'invokeOutput')\n\n if (\n (!this.minimalMode &&\n typeof invokeOutput === 'string' &&\n isDynamicRoute(invokeOutput || '') &&\n invokeOutput !== existingMatch?.definition.pathname) ||\n // Parallel routes are matched in `existingMatch` but since currently\n // there can be multiple matches it's not guaranteed to be the right match\n // therefor we need to opt-out of the fast path for parallel routes.\n existingMatch?.definition.page.includes('/@')\n ) {\n fastPath = false\n }\n\n try {\n for await (const match of fastPath && existingMatch\n ? [existingMatch]\n : this.matchers.matchAll(pathname, options)) {\n if (\n !this.minimalMode &&\n typeof invokeOutput === 'string' &&\n isDynamicRoute(invokeOutput || '') &&\n invokeOutput !== match.definition.pathname\n ) {\n continue\n }\n\n const result = await this.renderPageComponent(\n {\n ...ctx,\n pathname: match.definition.pathname,\n renderOpts: {\n ...ctx.renderOpts,\n params: match.params,\n },\n },\n bubbleNoFallback\n )\n if (result !== false) return result\n }\n\n // currently edge functions aren't receiving the x-matched-path\n // header so we need to fallback to matching the current page\n // when we weren't able to match via dynamic route to handle\n // the rewrite case\n // @ts-expect-error extended in child class web-server\n if (this.serverOptions.webServerConfig) {\n // @ts-expect-error extended in child class web-server\n ctx.pathname = this.serverOptions.webServerConfig.page\n const result = await this.renderPageComponent(ctx, bubbleNoFallback)\n if (result !== false) return result\n }\n } catch (error) {\n const err = getProperError(error)\n\n if (error instanceof MissingStaticPage) {\n console.error(\n 'Invariant: failed to load static page',\n JSON.stringify(\n {\n page,\n url: ctx.req.url,\n matchedPath: ctx.req.headers[MATCHED_PATH_HEADER],\n initUrl: getRequestMeta(ctx.req, 'initURL'),\n didRewrite: !!getRequestMeta(ctx.req, 'rewroteURL'),\n rewroteUrl: getRequestMeta(ctx.req, 'rewroteURL'),\n },\n null,\n 2\n )\n )\n throw err\n }\n\n if (err instanceof NoFallbackError && bubbleNoFallback) {\n throw err\n }\n if (err instanceof DecodeError || err instanceof NormalizeError) {\n res.statusCode = 400\n return await this.renderErrorToResponse(ctx, err)\n }\n\n res.statusCode = 500\n\n // if pages/500 is present we still need to trigger\n // /_error `getInitialProps` to allow reporting error\n if (await this.hasPage('/500')) {\n addRequestMeta(ctx.req, 'customErrorRender', true)\n await this.renderErrorToResponse(ctx, err)\n removeRequestMeta(ctx.req, 'customErrorRender')\n }\n\n const isWrappedError = err instanceof WrappedBuildError\n\n if (!isWrappedError) {\n if (this.minimalMode || this.renderOpts.dev) {\n if (isError(err)) err.page = page\n throw err\n }\n this.logError(getProperError(err))\n }\n const response = await this.renderErrorToResponse(\n ctx,\n isWrappedError ? (err as WrappedBuildError).innerError : err\n )\n return response\n }\n\n const middleware = await this.getMiddleware()\n if (\n middleware &&\n !!ctx.req.headers['x-nextjs-data'] &&\n (!res.statusCode || res.statusCode === 200 || res.statusCode === 404)\n ) {\n const locale = getRequestMeta(req, 'locale')\n\n res.setHeader(\n 'x-nextjs-matched-path',\n `${locale ? `/${locale}` : ''}${pathname}`\n )\n res.statusCode = 200\n res.setHeader('Content-Type', JSON_CONTENT_TYPE_HEADER)\n res.body('{}')\n res.send()\n return null\n }\n\n res.statusCode = 404\n return this.renderErrorToResponse(ctx, null)\n }\n\n public async renderToHTML(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise {\n return getTracer().trace(BaseServerSpan.renderToHTML, async () => {\n return this.renderToHTMLImpl(req, res, pathname, query)\n })\n }\n\n private async renderToHTMLImpl(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise {\n return this.getStaticHTML((ctx) => this.renderToResponse(ctx), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n public async renderError(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n setHeaders = true\n ): Promise {\n return getTracer().trace(BaseServerSpan.renderError, async () => {\n return this.renderErrorImpl(err, req, res, pathname, query, setHeaders)\n })\n }\n\n private async renderErrorImpl(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n setHeaders = true\n ): Promise {\n if (setHeaders) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n return this.pipe(\n async (ctx) => {\n const response = await this.renderErrorToResponse(ctx, err)\n if (this.minimalMode && res.statusCode === 500) {\n throw err\n }\n return response\n },\n { req, res, pathname, query }\n )\n }\n\n private customErrorNo404Warn = execOnce(() => {\n Log.warn(\n `You have added a custom /_error page without a custom /404 page. This prevents the 404 page from being auto statically optimized.\\nSee here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`\n )\n })\n\n private async renderErrorToResponse(\n ctx: RequestContext,\n err: Error | null\n ): Promise {\n return getTracer().trace(BaseServerSpan.renderErrorToResponse, async () => {\n return this.renderErrorToResponseImpl(ctx, err)\n })\n }\n\n protected async renderErrorToResponseImpl(\n ctx: RequestContext,\n err: Error | null\n ): Promise {\n // Short-circuit favicon.ico in development to avoid compiling 404 page when the app has no favicon.ico.\n // Since favicon.ico is automatically requested by the browser.\n if (this.renderOpts.dev && ctx.pathname === '/favicon.ico') {\n return {\n body: RenderResult.EMPTY,\n }\n }\n const { res, query } = ctx\n\n try {\n let result: null | FindComponentsResult = null\n\n const is404 = res.statusCode === 404\n let using404Page = false\n const hasAppDir = this.enabledDirectories.app\n\n if (is404) {\n if (hasAppDir) {\n // Use the not-found entry in app directory\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n query,\n params: {},\n isAppPath: true,\n shouldEnsure: true,\n url: ctx.req.url,\n })\n using404Page = result !== null\n }\n\n if (!result && (await this.hasPage('/404'))) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: '/404',\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" a 404 route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n using404Page = result !== null\n }\n }\n let statusPage = `/${res.statusCode}`\n\n if (\n !getRequestMeta(ctx.req, 'customErrorRender') &&\n !result &&\n STATIC_STATUS_PAGES.includes(statusPage)\n ) {\n // skip ensuring /500 in dev mode as it isn't used and the\n // dev overlay is used instead\n if (statusPage !== '/500' || !this.renderOpts.dev) {\n if (!result && hasAppDir) {\n // Otherwise if app router present, load app router built-in 500 page\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: statusPage,\n query,\n params: {},\n isAppPath: true,\n // Ensuring can't be done here because you never \"match\" a 500\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n }\n // If the above App Router result is empty, fallback to pages router 500 page\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: statusPage,\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" a 500\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n }\n }\n\n if (!result) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: '/_error',\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" an error\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n statusPage = '/_error'\n }\n\n if (\n process.env.NODE_ENV !== 'production' &&\n !using404Page &&\n (await this.hasPage('/_error')) &&\n !(await this.hasPage('/404'))\n ) {\n this.customErrorNo404Warn()\n }\n\n if (!result) {\n // this can occur when a project directory has been moved/deleted\n // which is handled in the parent process in development\n if (this.renderOpts.dev) {\n return {\n // wait for dev-server to restart before refreshing\n body: RenderResult.fromStatic(\n `\n
missing required error components, refreshing...
\n `,\n HTML_CONTENT_TYPE_HEADER\n ),\n }\n }\n\n throw new WrappedBuildError(\n new Error('missing required error components')\n )\n }\n\n // If the page has a route module, use it for the new match. If it doesn't\n // have a route module, remove the match.\n if (result.components.routeModule) {\n addRequestMeta(ctx.req, 'match', {\n definition: result.components.routeModule.definition,\n params: undefined,\n })\n } else {\n removeRequestMeta(ctx.req, 'match')\n }\n\n try {\n return await this.renderToResponseWithComponents(\n {\n ...ctx,\n pathname: statusPage,\n renderOpts: {\n ...ctx.renderOpts,\n err,\n },\n },\n result\n )\n } catch (maybeFallbackError) {\n if (maybeFallbackError instanceof NoFallbackError) {\n throw new Error('invariant: failed to render error page')\n }\n throw maybeFallbackError\n }\n } catch (error) {\n const renderToHtmlError = getProperError(error)\n const isWrappedError = renderToHtmlError instanceof WrappedBuildError\n if (!isWrappedError) {\n this.logError(renderToHtmlError)\n }\n res.statusCode = 500\n const fallbackComponents = await this.getFallbackErrorComponents(\n ctx.req.url\n )\n\n if (fallbackComponents) {\n // There was an error, so use it's definition from the route module\n // to add the match to the request.\n addRequestMeta(ctx.req, 'match', {\n definition: fallbackComponents.routeModule!.definition,\n params: undefined,\n })\n\n return this.renderToResponseWithComponents(\n {\n ...ctx,\n pathname: '/_error',\n renderOpts: {\n ...ctx.renderOpts,\n // We render `renderToHtmlError` here because `err` is\n // already captured in the stacktrace.\n err: isWrappedError\n ? renderToHtmlError.innerError\n : renderToHtmlError,\n },\n },\n {\n query,\n components: fallbackComponents,\n }\n )\n }\n return {\n body: RenderResult.fromStatic('Internal Server Error', 'text/plain'),\n }\n }\n }\n\n public async renderErrorToHTML(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise {\n return this.getStaticHTML((ctx) => this.renderErrorToResponse(ctx, err), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n public async render404(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: Pick,\n setHeaders = true\n ): Promise {\n const { pathname, query } = parsedUrl ? parsedUrl : parseUrl(req.url!, true)\n\n // Ensure the locales are provided on the request meta.\n if (this.nextConfig.i18n) {\n if (!getRequestMeta(req, 'locale')) {\n addRequestMeta(req, 'locale', this.nextConfig.i18n.defaultLocale)\n }\n addRequestMeta(req, 'defaultLocale', this.nextConfig.i18n.defaultLocale)\n }\n\n res.statusCode = 404\n return this.renderError(null, req, res, pathname!, query, setHeaders)\n }\n}\n"],"names":["NormalizeError","DecodeError","normalizeRepeatedSlashes","MissingStaticPage","path","format","formatUrl","parse","parseUrl","formatHostname","APP_PATHS_MANIFEST","NEXT_BUILTIN_DOCUMENT","PAGES_MANIFEST","STATIC_STATUS_PAGES","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","isDynamicRoute","execOnce","isBlockedPage","getBotType","isBot","RenderResult","removeTrailingSlash","denormalizePagePath","Log","getServerUtils","isError","getProperError","addRequestMeta","getRequestMeta","removeRequestMeta","setRequestMeta","removePathPrefix","normalizeAppPath","getHostname","parseUrlUtil","getNextPathnameInfo","RSC_HEADER","NEXT_RSC_UNION_QUERY","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_URL","NEXT_ROUTER_STATE_TREE_HEADER","LocaleRouteNormalizer","DefaultRouteMatcherManager","AppPageRouteMatcherProvider","AppRouteRouteMatcherProvider","PagesAPIRouteMatcherProvider","PagesRouteMatcherProvider","ServerManifestLoader","getTracer","isBubbledError","SpanKind","SpanStatusCode","BaseServerSpan","I18NProvider","sendResponse","normalizeNextQueryParam","HTML_CONTENT_TYPE_HEADER","JSON_CONTENT_TYPE_HEADER","MATCHED_PATH_HEADER","NEXT_RESUME_HEADER","normalizeLocalePath","matchNextDataPathname","getRouteFromAssetPath","RSCPathnameNormalizer","stripFlightHeaders","isAppPageRouteModule","isAppRouteRouteModule","PrefetchRSCPathnameNormalizer","NextDataPathnameNormalizer","getIsPossibleServerAction","isInterceptionRouteAppPath","toRoute","isNodeNextRequest","isNodeNextResponse","patchSetHeaderWithCookieSupport","checkIsAppPPREnabled","getBuiltinRequestContext","NextRequestHint","parseFallbackField","SegmentPrefixRSCPathnameNormalizer","shouldServeStreamingMetadata","decodeQueryPathParameter","NoFallbackError","fixMojibake","computeCacheBustingSearchParam","setCacheBustingSearchParamWithHash","createOpaqueFallbackRouteParams","RouteKind","WrappedBuildError","Error","constructor","innerError","Server","getServerComponentsHmrCache","nextConfig","experimental","serverComponentsHmrCache","globalThis","__serverComponentsHmrCache","undefined","options","handleRSCRequest","req","_res","parsedUrl","pathname","normalizers","segmentPrefetchRSC","match","result","extract","originalPathname","segmentPath","headers","prefetchRSC","normalize","rsc","segmentPrefetchRSCRequest","url","parsed","handleNextDataRequest","res","middleware","getMiddleware","params","buildId","render404","shift","lastParam","length","endsWith","join","trailingSlash","substring","i18nProvider","hostname","host","split","toLowerCase","domainLocale","detectDomainLocale","defaultLocale","config","localePathResult","analyze","detectedLocale","handleNextImageRequest","handleCatchallRenderRequest","handleCatchallMiddlewareRequest","data","push","normalizer","normalizeAndAttachMetadata","finished","enabledDirectories","pages","prepared","preparedPromise","customErrorNo404Warn","warn","dir","quiet","conf","dev","minimalMode","port","experimentalTestProxy","serverOptions","resolve","loadEnvConfig","forceReload","fetchHostname","distDir","publicDir","getPublicDir","hasStaticDir","getHasStaticDir","i18n","locales","localeNormalizer","assetPrefix","generateEtags","getBuildId","minimalModeKey","process","env","NEXT_PRIVATE_MINIMAL_MODE","getEnabledDirectories","isAppPPREnabled","app","ppr","isAppSegmentPrefetchEnabled","clientSegmentCache","nextFontManifest","getNextFontManifest","NEXT_DEPLOYMENT_ID","deploymentId","renderOpts","supportsDynamicResponse","poweredByHeader","previewProps","getPrerenderManifest","preview","basePath","images","optimizeCss","nextConfigOutput","output","nextScriptWorkers","disableOptimizedLoading","domainLocales","domains","serverComponents","cacheLifeProfiles","cacheLife","enableTainting","taint","crossOrigin","largePageDataBytes","isExperimentalCompile","htmlLimitedBots","cacheComponents","expireTime","staleTimes","clientTraceMetadata","Boolean","clientParamParsingOrigins","dynamicOnHover","inlineCss","authInterrupts","onInstrumentationRequestError","instrumentationOnRequestError","bind","reactMaxHeadersLength","pagesManifest","getPagesManifest","appPathsManifest","getAppPathsManifest","appPathRoutes","getAppPathRoutes","interceptionRoutePatterns","getinterceptionRoutePatterns","matchers","getRouteMatchers","reload","setAssetPrefix","responseCache","getResponseCache","reloadMatchers","manifestLoader","name","args","err","ctx","instrumentation","onRequestError","method","Object","fromEntries","entries","handlerErr","console","error","logError","handleRequest","prepare","toUpperCase","tracer","withPropagatedContext","trace","spanName","kind","SERVER","attributes","span","handleRequestImpl","finally","isRSCRequest","setAttributes","statusCode","setStatus","code","ERROR","setAttribute","toString","rootSpanAttributes","getRootSpanAttributes","get","route","updateName","originalRequest","waitTillReady","originalResponse","urlParts","urlNoQuery","cleanUrl","redirect","body","send","query","URLSearchParams","xForwardedProto","isHttps","socket","encrypted","remoteAddress","attachRequestMeta","replace","pathnameInfo","useMatchedPathHeader","matchedPath","URL","urlPathname","chunk","postponed","Buffer","concat","normalizedUrlPath","stripNextDataPath","localeAnalysisResult","inferredFromDefault","srcPathname","pageIsDynamic","paramsResult","hasValidParams","definition","utils","page","rewrites","getRoutesManifest","beforeFiles","afterFiles","fallback","caseSensitive","caseSensitiveRoutes","locale","originQueryParams","pathnameBeforeRewrite","rewriteParams","rewrittenParsedUrl","handleRewrites","rewriteParamKeys","keys","rewrittenQueryParams","didRewrite","routeParamKeys","Set","key","value","normalizedKey","add","Array","isArray","map","v","normalizeDynamicRouteParams","matcherParams","dynamicRouteMatcher","assign","curParamsResult","routeMatchesHeader","routeMatches","getParamsFromRouteMatches","defaultRouteMatches","interpolateDynamicPath","normalizeCdnUrl","defaultRouteRegex","groups","PAGES","PAGES_API","renderError","webServerConfig","incrementalCache","getIncrementalCache","requestHeaders","resetRequestCache","__incrementalCache","invokePath","useInvokePath","invokeStatus","invokeQuery","parsedMatchedPath","invokePathnameInfo","parseData","normalizeResult","response","Response","bubble","run","getRequestHandlerWithMetadata","meta","handler","getRequestHandler","prefix","loadInstrumentationModule","prepareImpl","then","close","forEach","entry","normalizedPath","runImpl","pipe","fn","partialContext","pipeImpl","ua","botType","serveStreamingMetadata","payload","originalStatus","cacheControl","sent","setHeader","expire","sendRenderResult","getStaticHTML","toUnchunkedString","render","internalRender","renderImpl","getWaitUntil","builtinRequestContext","waitUntil","getInternalWaitUntil","startsWith","customServer","hasPage","renderToResponse","getStaticPaths","fallbackField","dynamicRoutes","staticPaths","fallbackMode","renderToResponseWithComponents","requestContext","findComponentsResult","renderToResponseWithComponentsImpl","pathCouldBeIntercepted","resolvedPathname","some","regexp","test","setVaryHeader","isAppPath","baseVaryHeader","addedNextUrlToVary","appendHeader","opts","components","prerenderManifest","isErrorPathname","is404Page","is500Page","hasServerProps","getServerSideProps","isPossibleServerAction","isSSG","getStaticProps","validateRSCRequestHeaders","prefetchHeaderValue","routerPrefetch","expectedHash","actualHash","searchParams","search","resolvedUrlPathname","hasFallback","includes","routes","isNextDataRequest","routeModule","couldSupportPPR","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","isRoutePPREnabled","renderingMode","minimalPostponed","parseInt","slice","Component","fromStatic","isBotRequest","isSupportedDocument","Document","getInitialProps","isDev","pathsResults","prerenderedRoutes","smallestFallbackRouteParams","fallbackRouteParams","status","request","parsedInitUrl","initPathname","ComponentMod","maybeDevRequest","NODE_ENV","Proxy","target","prop","set","fetchMetrics","filePath","stripLocale","splitPath","indexOf","getOriginalAppPaths","originalAppPath","renderPageComponent","bubbleNoFallback","appPaths","findPageComponents","sriEnabled","sri","algorithm","shouldEnsure","setRootSpanAttribute","isNoFallbackError","renderToResponseImpl","fromRequest","existingMatch","fastPath","invokeOutput","matchAll","JSON","stringify","initUrl","rewroteUrl","renderErrorToResponse","isWrappedError","renderToHTML","renderToHTMLImpl","setHeaders","renderErrorImpl","renderErrorToResponseImpl","EMPTY","is404","using404Page","hasAppDir","statusPage","maybeFallbackError","renderToHtmlError","fallbackComponents","getFallbackErrorComponents","renderErrorToHTML"],"mappings":"AAqBA,SACEA,cAAc,EACdC,WAAW,EACXC,wBAAwB,EACxBC,iBAAiB,QACZ,sBAAqB;AAqB5B,YAAYC,UAAU,OAAM;AAC5B,SAASC,UAAUC,SAAS,EAAEC,SAASC,QAAQ,QAAQ,MAAK;AAC5D,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,cAAc,EACdC,mBAAmB,EACnBC,0BAA0B,EAC1BC,gCAAgC,QAC3B,0BAAyB;AAChC,SAASC,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,aAAa,QAAQ,UAAS;AACvC,SAASC,UAAU,EAAEC,KAAK,QAAQ,oCAAmC;AACrE,OAAOC,kBAAkB,kBAAiB;AAC1C,SAASC,mBAAmB,QAAQ,mDAAkD;AACtF,SAASC,mBAAmB,QAAQ,gDAA+C;AACnF,YAAYC,SAAS,sBAAqB;AAC1C,SAASC,cAAc,Q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