Skip to content

Commit

Permalink
Use req.originalUrl for better Vite compatibility (#7343)
Browse files Browse the repository at this point in the history
* Use req.originalUrl for better Vite compatibility

* Revert "Use req.originalUrl for better Vite compatibility"

This reverts commit bd5dafb.

* set url to originalUrl

* Create lucky-moles-count.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>
  • Loading branch information
benmccann and Rich-Harris committed Oct 28, 2022
1 parent 7b1a375 commit 822d283
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-moles-count.md
@@ -0,0 +1,5 @@
---
"@sveltejs/kit": patch
---

Restore `req.url` to `req.originalUrl` in dev and preview
2 changes: 2 additions & 0 deletions packages/kit/src/exports/vite/dev/index.js
Expand Up @@ -291,6 +291,8 @@ export async function dev(vite, vite_config, svelte_config) {
remove_static_middlewares(vite.middlewares);

vite.middlewares.use(async (req, res) => {
// Vite's base middleware strips out the base path. Restore it
req.url = req.originalUrl;
try {
const base = `${vite.config.server.https ? 'https' : 'http'}://${
req.headers[':authority'] || req.headers.host
Expand Down

0 comments on commit 822d283

Please sign in to comment.