-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
breaking changep2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Describe the bug
Vite strips the base URL to avoid other middlewares from having to worry about the base URL:
| req.url = url.replace(devBase, '/') |
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 of Not 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:
- https://expressjs.com/en/resources/middleware/morgan.html
- http://expressjs.com/en/resources/middleware/session.html (if cookie path is set)
- https://github.com/expressjs/express-paginate
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
| req.url = url.replace(devBase, '/') |
System Info
`main`Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 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.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changep2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Type
Projects
Status
No status