-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Vite strips base URL from request #9234
Comments
We came up with an easy workaround for this: sveltejs/kit#7343 That's enough for SvelteKit. It could still cause problems for users if they have generic middlewares they want to use, but this is lower in priority now |
We discussed this briefly last meeting (I think Ben was there too) that reverting the I didn't know of the |
I wouldn't object to closing this. In any case, it's low enough priority now that I'm not going to pursue it |
About |
I had thought about that, but didn't think it'd be an issue as it'd only cause trouble if they come after the SvelteKit middleware and I believe none do, so it should be safe. We could restore the URL Vite provides at the end of processing if this turns out not to be the case. |
If the SvelteKit middlewares are always expected to be last, then I think you could close this issue @benmccann, the PR you merged then looks good for now to me too 👍🏼 |
Describe the bug
Vite strips the base URL to avoid other middlewares from having to worry about the base URL:
vite/packages/vite/src/node/server/middlewares/base.ts
Line 20 in dfaeb2b
Unfortunately, it doesn't really save us from having to worry about the base path and creates a number of broken / unexpected behaviors. E.g. our 404 messages print
Not found: /whatever
instead ofNot found: /basepath/whatever
.While SvelteKit could change its own middleware, that's impossible off-the-shelf middlewares that users might. Some examples that are broken with Vite:
SvelteKit does not use Vite's static asset serving because of this, but I'd love just use Vite's instead of recreating our own
Reproduction
vite/packages/vite/src/node/server/middlewares/base.ts
Line 20 in dfaeb2b
System Info
`main`
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: