Skip to content

Commit

Permalink
Ensure we properly normalize /index in minimal mode (#41678)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 23, 2022
1 parent a105515 commit 70a128e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/next/server/base-server.ts
Expand Up @@ -526,6 +526,15 @@ export default abstract class Server<ServerOptions extends Options = Options> {
typeof req.headers['x-matched-path'] === 'string'
) {
try {
if (this.hasAppDir) {
// ensure /index path is normalized for prerender
// in minimal mode
if (req.url.match(/^\/index($|\?)/)) {
req.url = req.url.replace(/^\/index/, '/')
}
parsedUrl.pathname =
parsedUrl.pathname === '/index' ? '/' : parsedUrl.pathname
}
// x-matched-path is the source of truth, it tells what page
// should be rendered because we don't process rewrites in minimalMode
let matchedPath = normalizeRscPath(
Expand Down

0 comments on commit 70a128e

Please sign in to comment.