Unverified Commit 70a128e7 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure we properly normalize /index in minimal mode (#41678)

x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1666030147833759)
parent a1055157
...@@ -526,6 +526,15 @@ export default abstract class Server<ServerOptions extends Options = Options> { ...@@ -526,6 +526,15 @@ export default abstract class Server<ServerOptions extends Options = Options> {
typeof req.headers['x-matched-path'] === 'string' typeof req.headers['x-matched-path'] === 'string'
) { ) {
try { 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 // x-matched-path is the source of truth, it tells what page
// should be rendered because we don't process rewrites in minimalMode // should be rendered because we don't process rewrites in minimalMode
let matchedPath = normalizeRscPath( let matchedPath = normalizeRscPath(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment