question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No language redirect from `/` when using `nuxt generate` in `prefix` mode

See original GitHub issue

This bug is related to #677, where no redirect was generated in dev in spa mode. It seems that in production mode, the same issue occurs.

Version

nuxt-i18n: 6.11.0 nuxt: 2.12.2

Reproduction Link

https://github.com/dokterbob/i18nuxt-redirect-bug

Steps to reproduce

  1. Clean nuxt project with i18-nuxt configured with strategy set to `prefix’ as per documentation (refer to reproduction link) and ‘mode’ set to ‘spa’ as per documentation
  2. Generate a production build either with npm run build or npm run generate (identical results and inconsistent documentation for nuxt.js)
  3. Statically serve dist folder, e.g. serve dist/
  4. Open / on server, e.g. http://localhost:5000/ when serve dist/ is used.

What is Expected?

An index pages is loaded causing a redirect to a language prefix (e.g. /en/ or /pt/).

What is actually happening?

No index file is present, depending on the webserver either a 404 is returned or a directory listing is generated.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
rchlcommented, Jul 24, 2020

I’d appreciate it if you could create a separate issue for this in this repo as it seems to be specific to the new full static mode. I need to find a way to detect it and apply same logic as for generate.

Note that next version of Nuxt will do some command renaming again (deprecate the export command) so might be better to wait for that before taking a look.

0reactions
notflipcommented, Dec 23, 2022

This issue is still happening, I’m using nginx and when I run yarn generate I’m getting no index.html in the output folder so nginx throws a 404. Any idea how to go about this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No language redirect from / when using nuxt generate in prefix ...
This bug is related to #677, where no redirect was generated in dev in spa mode. It seems that in production mode, the...
Read more >
Redirect to locale with Nuxtjs and i18n on SPA mode
I got an idea to solve this problem but I did not know if it is the best solution. Just using .htaccess to...
Read more >
Options - i18n-module
When using prefix_except_default strategy, URLs for locale specified here won't have a prefix. It's recommended to set this to some locale regardless of...
Read more >
Rewrites - next.config.js
Rewrites act as a URL proxy and mask the destination path, making it appear the user hasn't changed their location on the site....
Read more >
nuxt-i18n | Yarn - Package Manager
Integration with vue-i18n · Automatic routes generation and custom paths · Search Engine Optimization · Lazy-loading of translation messages · Redirection based on ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found