Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FabianRzepka opened this issue Feb 15, 2024 · 0 comments

Comments

@FabianRzepka
Copy link

FabianRzepka commented Feb 15, 2024

Environment

  • Operating System: Windows_NT
  • Node Version: v20.9.0
  • Nuxt Version: 3.10.1
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: pnpm@8.9.2
  • Builder: -
  • User Config: app, vue, ssr, devtools, modules, image, googleFonts, i18n
  • Runtime Modules: @nuxtjs/i18n@8.1.0, @nuxtjs/tailwindcss@6.11.4, @nuxtjs/google-fonts@3.1.3, @nuxt/image@1.3.0, nuxt-icon@0.6.8, nuxt-headlessui@1.1.5
  • Build Modules: -

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 build works 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

@FabianRzepka FabianRzepka changed the title Strategy prefix not redirecting detectBrowserLanguage correctly on root after static pre-rendering. Strategy prefix with detectBrowserLanguage not redirecting correctly on root in Static Site Generation Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants