;
+ }
+ `,
+ },
+ });
+ appFixture = await createAppFixture(fixture);
+
+ let encodedMultibytePath = encodeURIComponent("ページ");
+ let requests = captureRequests(page);
+ let app = new PlaywrightFixture(appFixture, page);
+ await app.goto("/", true);
+ await page.waitForSelector("[data-index]");
+
+ await app.clickLink("/page");
+ await page.waitForSelector("[data-page]");
+ expect(await (await page.$("[data-page]"))?.innerText()).toBe(
+ "PAGE DATA"
+ );
+ expect(requests).toEqual(["/page.data"]);
+ clearRequests(requests);
+
+ await app.clickLink("/ページ");
+ await page.waitForSelector("[data-multibyte-page]");
+ expect(await (await page.$("[data-multibyte-page]"))?.innerText()).toBe(
+ "ページ データ"
+ );
+ expect(requests).toEqual([`/${encodedMultibytePath}.data`]);
+ })
+
test("Returns a 404 if navigating to a non-prerendered param value", async ({
page,
}) => {
diff --git a/packages/react-router/lib/server-runtime/server.ts b/packages/react-router/lib/server-runtime/server.ts
index 5bbe24e801..89b7df110c 100644
--- a/packages/react-router/lib/server-runtime/server.ts
+++ b/packages/react-router/lib/server-runtime/server.ts
@@ -172,14 +172,17 @@ export const createRequestHandler: CreateRequestHandlerFunction = (
// When runtime SSR is disabled, make our dev server behave like the deployed
// pre-rendered site would
if (!_build.ssr) {
+ // Decode the URL path before checking against the prerender config
+ let decodedPath = decodeURI(normalizedPath);
+
// When SSR is disabled this, file can only ever run during dev because we
// delete the server build at the end of the build
if (_build.prerender.length === 0) {
// ssr:false and no prerender config indicates "SPA Mode"
isSpaMode = true;
} else if (
- !_build.prerender.includes(normalizedPath) &&
- !_build.prerender.includes(normalizedPath + "/")
+ !_build.prerender.includes(decodedPath) &&
+ !_build.prerender.includes(decodedPath + "/")
) {
if (url.pathname.endsWith(".data")) {
// 404 on non-pre-rendered `.data` requests
@@ -187,7 +190,7 @@ export const createRequestHandler: CreateRequestHandlerFunction = (
new ErrorResponseImpl(
404,
"Not Found",
- `Refusing to SSR the path \`${normalizedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`
+ `Refusing to SSR the path \`${decodedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`
),
{
context: loadContext,