Skip to content

Commit

Permalink
[fix] correctly populate event.url.host in dev mode when using `--h…
Browse files Browse the repository at this point in the history
…ttps` (#4364)
  • Loading branch information
benmccann authored Mar 17, 2022
1 parent a8fa9b0 commit e8fec56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/five-turtles-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] correctly populate `event.url.host` in dev mode when using `--https`
4 changes: 3 additions & 1 deletion packages/kit/src/core/dev/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ export async function create_plugin(config, cwd) {
try {
if (!req.url || !req.method) throw new Error('Incomplete request');

const base = `${vite.config.server.https ? 'https' : 'http'}://${req.headers.host}`;
const base = `${vite.config.server.https ? 'https' : 'http'}://${
req.headers[':authority'] || req.headers.host
}`;

const decoded = decodeURI(new URL(base + req.url).pathname);

Expand Down

0 comments on commit e8fec56

Please sign in to comment.