Skip to content

Fix App Router 404 with Pages Router i18n domain routing#86116

Draft
ruudk wants to merge 1 commit into
vercel:canaryfrom
ruudk:fix-86048
Draft

Fix App Router 404 with Pages Router i18n domain routing#86116
ruudk wants to merge 1 commit into
vercel:canaryfrom
ruudk:fix-86048

Conversation

@ruudk
Copy link
Copy Markdown

@ruudk ruudk commented Nov 14, 2025

What?

When Pages Router uses domain-based i18n configuration, it was stripping locale prefixes from ALL requests, breaking App Router routes that need those prefixes for dynamic segments like [lang].

This fix detects when a path could match an App Router route with a dynamic locale segment and preserves the locale prefix for those routes while still stripping it for Pages Router routes.

How?

  • Add detect-app-router-locale-route utility with route matching
  • Fix locale stripping in base-server, next-server, resolve-routes
  • Add comprehensive unit tests (29 test cases)
  • Add e2e reproducer test demonstrating the fix

The fix allows both routers to coexist when middleware rewrites paths with locale prefixes for App Router consumption.

Fixes #86048

@ruudk ruudk force-pushed the fix-86048 branch 2 times, most recently from f03c44d to b99a1ff Compare November 14, 2025 07:08
When Pages Router uses domain-based i18n configuration, it was
stripping locale prefixes from ALL requests, breaking App Router
routes that need those prefixes for dynamic segments like [lang].

This fix detects when a path could match an App Router route with
a dynamic locale segment and preserves the locale prefix for those
routes while still stripping it for Pages Router routes.

Changes:
- Add detect-app-router-locale-route utility with route matching
- Fix locale stripping in base-server, next-server, resolve-routes
- Add comprehensive unit tests (29 test cases)
- Add e2e reproducer test demonstrating the fix

The fix allows both routers to coexist when middleware rewrites
paths with locale prefixes for App Router consumption.

Fixes vercel#86048
@ruudk
Copy link
Copy Markdown
Author

ruudk commented Nov 14, 2025

@ijjk Hi 👋 How do I get the CI to run?

@idmedia-kaiser
Copy link
Copy Markdown

idmedia-kaiser commented Jan 23, 2026

@ruudk Are you still working on this? Or found a solution?
@timneutkens @ijjk Can you help here, or can say if such a "fix" in on the roadmap ? there are several issues in regards to migration from pages router to the app router when using i8n
#48619
#51009
#53724
#86048

@ruudk
Copy link
Copy Markdown
Author

ruudk commented Jan 23, 2026

I don't think this is the best solution. But we still have this issue. It would be great if this could be solved. Happy to test any solution that comes along. @timneutkens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App Router routes return 404 when using Pages Router i18n with domain routing

3 participants