Skip to content

Revert "Revert "Fix App Router locale path matching with Pages i18n"" - #98726

Merged
timneutkens merged 7 commits into
canaryfrom
revert-98715-revert-98095-codex/fix-app-i18n-runtime-routing
Oct 30, 2026
Merged

timneutkens merged 7 commits into
canaryfrom
revert-98715-revert-98095-codex/fix-app-i18n-runtime-routing

Conversation

@timneutkens

Copy link
Copy Markdown
Contributor

Reverts #98715. Re-apply the i18n fix.

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 077789d

@timneutkens
timneutkens marked this pull request as ready for review September 17, 2026 08:34
@timneutkens
timneutkens force-pushed the revert-98715-revert-98095-codex/fix-app-i18n-runtime-routing branch from 5875271 to 1ca94f2 Compare October 16, 2026 11:29
roboeve[bot]

This comment was marked as outdated.

@timneutkens

Copy link
Copy Markdown
Contributor Author

[P1] Preserve inferred locales across Proxy rewrites

The new localePathWasInferred = false assignment in resolve-routes.ts treats every locale in a Proxy rewrite destination as explicit. However, server/web/adapter.ts already recreates same-host rewrite destinations with NextURL({ forceLocale: true }), which inserts the default/domain locale even when the Proxy destination was unlocalized.

Reproduction using this PR's fixture:

return NextResponse.rewrite(new URL('/plain/123', request.url))

From an unlocalized Proxy source pathname, this should render app/plain/[id] with id = '123'. Instead, the PR renders app/[lang]/[...slug] with lang = 'en-US' or 'nl-NL' and slug = ['plain', '123']. Without that localized catch-all, the request returns 404.

Confirmed on both configured locale domains in development and production with Webpack. The base routes both requests to app/plain/[id] correctly. The original 14 regression cases pass on this PR.

The resolver needs to distinguish adapter-inferred locale prefixes from explicit rewrite destinations before choosing literal App route matching. I am investigating a fix and adding coverage for unlocalized Proxy destinations.

@timneutkens
timneutkens requested review from unstubbable and removed request for unstubbable October 30, 2026 12:36
@timneutkens
timneutkens merged commit 7c5089f into canary Oct 30, 2026
125 checks passed
@timneutkens
timneutkens deleted the revert-98715-revert-98095-codex/fix-app-i18n-runtime-routing branch October 30, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants