next.js
4e2353ed - fix: app-page URL normalization (#91121)

Commit
120 days ago
fix: app-page URL normalization (#91121) ## Summary Fix an App Router request normalization gap where app-page route-module requests could keep internal RSC/segment-prefetch URLs in `req.url`. This could leak paths like: - `.../.segments/_tree.segment.rsc` - `.../__PAGE__.segment.rsc` into App Router render state and surface through `usePathname()` during server rendering. ## What changed - Normalize `req.url` in the app-page route-module path after `.rsc` and `.segments/*.segment.rsc` pathname normalization. ## Why `base-server` already keeps `req.url` in sync after RSC normalization ([ref](https://github.com/vercel/next.js/blob/5e11e67759fa38fe67f70790d7bba8c9ff9ba5fd/packages/next/src/server/base-server.ts#L676-L680)), but the app-page route-module path only updated `parsedUrl.pathname`. Since App Router render state seeds its canonical URL from `req.url`, that desync could cause internal segment-prefetch paths to be treated as the current pathname.
Author
Parents
Loading