-
Notifications
You must be signed in to change notification settings - Fork 184
Description
Description
I am deploying a Next.js (Pages Router) application with i18n enabled using OpenNext.
When a user accesses the root path (/) and is redirected to a non-default locale (e.g., /en) based on their browser's language settings, any query parameters present in the original URL are lost during the redirection.
This behavior differs from the local Next.js environment (next dev / next start), where query parameters are correctly preserved.
Environment
OpenNext version: 3.9.4
Next.js version: 14.2.33
To Reproduce
-
Initialize a Next.js project
npx create-next-app@14 . # Select "Pages Router" npm install next-i18next react-i18next i18next
-
Configure i18n
// next-i18next.config.mjs export const i18n = { defaultLocale: 'ja', locales: ['en', 'ja'], }
// next.config.mjs import { i18n } from './next-i18next.config.mjs'; const nextConfig = { i18n, reactStrictMode: true, }; export default nextConfig;
-
Deploy using SST
npx sst@latest init npx sst deploy --stage production
-
Change your browser's preferred language to English.
-
Access the deployed root URL with query parameters:
https://example.com/?xxx=yyy
Expected behavior
The user should be redirected to the English locale path with query parameters preserved: https://example.com/en?xxx=yyy
Actual behavior
The user is redirected to the English locale path, but query parameters are missing: https://example.com/en