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

public subfolder name collision with route causes 301 redirect #26963

Open
mummybot opened this issue Apr 26, 2024 · 1 comment
Open

public subfolder name collision with route causes 301 redirect #26963

mummybot opened this issue Apr 26, 2024 · 1 comment

Comments

@mummybot
Copy link

Environment


  • Operating System: Darwin
  • Node Version: v18.19.0
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-sh3gjl
To see the redirect, you need to open the preview in its own browser window.

Local instructions:

npx nuxi@latest init public-error
cd public-error
npm run dev

Visit http://localhost:3000
Open DevTools and enable routing

mkdir pages/test
cp pages/index.vue pages/test/index.vue
mkdir public/test

Visit http://localhost:3000/test
301 redirect to /test/

Describe the bug

When using the dev server, when a route shares the exact same string as a folder within the public directory, a combination of vite dev server, h3, and send libraries check the public subfolder paths and on discovering a matching string and that it is a folder, then does a 301 redirect with a trailing slash. It never hits nitro until after the redirect occurs.

Additional context

No response

Logs

No response

Copy link

stackblitz bot commented Apr 26, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe danielroe removed the 3.x label Jun 30, 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