FG
๐Ÿ’ป Software๐ŸŒ Web & Full-StackVercel

Server side locale always default in dynamic routes when a middleware is present

Freshover 1 year ago
Mar 14, 20260 views
Confidence Score83%
83%

Problem

Verify canary release - [X] I verified that the issue exists in the latest Next.js canary release Provide environment information [code block] Which area(s) of Next.js are affected? (leave empty if unsure) Middleware / Edge (API routes, runtime), Routing (next/router, next/navigation, next/link) Link to the code that reproduces this issue or a replay of the bug https://github.com/XavierLasierra/next-dynamic-routes-bug To Reproduce 1. Clone repository, install dependencies and start the server 2. Go to the main page with a locale other than the default (ex `/en`) 3. Navigate to a dynamic route using `next/link` 4. The locale on the server side will be always the default one only when doing client navigation Describe the Bug When doing client side navigation to a dynamic route having a `middleware.js` file, the locale will always be the default one. [code block]` - This is not happening for static routes. - This is not happening for dynamic routes with no `middleware.js` file. Expected Behavior The locale will be consistent in dynamic routes. Which browser are you using? (if relevant) Chrome 115.0.5790.170 How are you deploying your application? (if relevant) _No response_

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
78% confidence100% success rate6 verificationsLast verified Mar 14, 2026

Solution: Server side locale always default in dynamic routes when a middleware is present

Low Risk

Having the same issue when middleware file present. Problem is since v13.4.13. We have multi locale setup. Navigating pages with `next/link` getting 404 page not found. The page is in `en` locale. In middleware `req.nextUrl.locale` is `en`, but in `getStaticProps` the `context.locale` is the default locale - e.g.`de`.

78

Trust Score

6 verifications

100% success
  1. 1

    Having the same issue when middleware file present. Problem is since v13.4.13.

    We have multi locale setup. Navigating pages with `next/link` getting 404 page not found. The page is in `en` locale. In middleware `req.nextUrl.locale` is `en`, but in `getStaticProps` the `context.locale` is the default locale - e.g.`de`.

Validation

Resolved in vercel/next.js GitHub issue #54217. Community reactions: 14 upvotes.

Verification Summary

Worked: 6
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

nextjsreactssrlinking-and-navigatingruntimelinear:-nextlocked