Dots in URL lead to 404 instead of index.html served
Describe the bug
When adding dots to the URL (i.e. /tag/10.4.1
) vite returns a 404 instead of index.html
Reproduction
n/a
System Info
- required
vite
version: 0.14.2 - required Operating System: OS X
- required Node version: 13.12.0
Logs (Optional if provided reproduction)
no logs, just a 404
So the problem is the following line: https://github.com/vuejs/vite/blob/master/src/node/server/serverPluginServeStatic.ts#L30
It prevents everything with a dot inside being redirected to index.html.
When dropping it, it happens that all JS files are redirected to index.html. This is due to await next()
being called in all plugins even if they already "handled" the request. Is this intentional?
I'd suggest to:
- Adjust server plugins to only call
next()
when the request was not handled - Use
ctx.path
instead of removing query and hash fromctx.url
inserverPluginServeStatic.ts
- Adjust the check for relative paths to
ctx.path !== path.resolve(ctx.path)
Would you agree on this? If so I'll file a PR
EDIT: What is even the reason to check for relative paths, I do not yet get this?