unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

404 error after running npx nuxi generate with app.baseURL set. #2579

Closed khopha closed 2 months ago

khopha commented 2 months ago

Environment

Reproduction

https://stackblitz.com/edit/github-zk6sfo

Steps:

  1. Set app.baseURL in nuxt.config.ts.
  2. Run npx nuxi generate.
  3. Run npm run preview.
  4. Click the links in the generated HTML.

Describe the bug

The links in the generated HTML navigate to a 404 error. After removing base from the URL, it works correctly. For example, localhost/base/about results in a 404 error, whereas localhost/about is correct.

Additional context

Reported in https://github.com/nuxt/nuxt/issues/27923

Logs

No response

danielroe commented 2 months ago

Thank you so much! I've created https://github.com/unjs/nitro/issues/2580 as a tracker issue which I think should fully resolve this. Let's track there. (Sorry for asking you to create this and then creating another issue instead. 🤦)