nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.75k stars 483 forks source link

Strategy prefix with detectBrowserLanguage not redirecting correctly on root in Static Site Generation #2790

Open FabianRzepka opened 9 months ago

FabianRzepka commented 9 months ago

Environment

Reproduction

https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-cs5xbf?file=nuxt.config.ts

On local work fine.

site.com/ --> click /nlto save cookie -->site.com/ redirect to site.com/nl

npm run generate npx serve .output/public

site.com/ --> click /nlto save cookie --> site.com/ redirect to default lang site.com/en

Describe the bug

After generating a static page with pnpm run generate and uploading it to hosting the application does not detect the existing cookie or browser language, in the case of (root) site.com it always redirects to defaultLocale (en) site.com/en. When running the site locally, pnpm run dev or run buildworks correctly.

in addition, the "prefix" mode adds an error in the console after entering the root path.

image

Additional context

related? old task #2507

No response

Logs

No response