Leading slash brokes the index page.
Environment
- Operating System: Linux
- Node Version: v24.2.0
- Nuxt Version: 4.1.2
- CLI Version: 3.28.0
- Nitro Version: 2.12.6
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, modules, ssr, nitro, scripts, i18n, app, css, ui, tailwindcss, image, fonts, runtimeConfig, ogImage, experimental, router, vite, site, sitemap, robots
- Runtime Modules: @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected], @nuxt/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected]
- Build Modules: -
Reproduction
- Create a mininmal site with i18n
- Use "prefix" strategy
- Create index page with different languages
Describe the bug
If you go to route like http://localhost:3000/en it works just fine but if you try to add leading slash like http://localhost:3000/en/ You will see 404 error
On real production site problem persists: https://eilattickets.com/en - works normally https://eilattickets.com/en/ - 404
Even worse, This problem prevents you from using prerendered site. For some reason prerendered page being always redirected to url with leading slash, making index page with langage prefix not accessible at all.
Any subroutes after prefix works exactly as they must.
Additional context
No response
Logs
Would you be able to provide a reproduction? 🙏
More info
Why do I need to provide a reproduction?
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
What will happen?
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.
If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
How can I create a reproduction?
We have a couple of templates for starting with a minimal reproduction:
👉 Reproduction starter (v8) 👉 Reproduction starter (v9) 👉 Reproduction starter (v10)
A public GitHub repository is also perfect. 👌
Please ensure that the reproduction is as minimal as possible. See more details in our guide.
You might also find these other articles interesting and/or helpful: