I am building a client for my file server and need to serve the same index.html for almost every path. Precisely, I am using server.proxy to map each path matching "/D:*" to "/" via vite.config.ts like this:
import {defineConfig} from "vite";
export default defineConfig({
// ... other options
server: {
proxy: {
"/D:*": "/"
}
}
});
But if I try to access http://localhost:5173/D:/Images, it restricts access because D:/Images (folder) exists. This is not unique to this folder; any path that exists is getting blocked, while paths that are not found just resolve to "/". This should not happen since the URL is getting remapped.
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I am building a client for my file server and need to serve the same index.html for almost every path. Precisely, I am using
server.proxy
to map each path matching"/D:*"
to"/"
viavite.config.ts
like this:But if I try to access
http://localhost:5173/D:/Images
, it restricts access because D:/Images (folder) exists. This is not unique to this folder; any path that exists is getting blocked, while paths that are not found just resolve to"/"
. This should not happen since the URL is getting remapped.Reproduction
https://stackblitz.com/edit/vitejs-vite-kchmac?file=vite.config.js
Steps to reproduce
Run
npm run dev
and navigate to the URL with pathname/@fs/bin
.System Info
Used Package Manager
pnpm
Logs
No response
Validations