Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
server.origin
1 parent f428aa9 commit 5946215Copy full SHA for 5946215
packages/vite/src/node/server/middlewares/hostCheck.ts
@@ -37,8 +37,12 @@ export function getAdditionalAllowedHosts(
37
// allow server origin by default as that indicates that the user is
38
// expecting Vite to respond on that host
39
if (resolvedServerOptions.origin) {
40
- const serverOriginUrl = new URL(resolvedServerOptions.origin)
41
- list.push(serverOriginUrl.hostname)
+ // some frameworks may pass the origin as a placeholder, so it's not
+ // possible to parse as URL, so use a try-catch here as a best effort
42
+ try {
43
+ const serverOriginUrl = new URL(resolvedServerOptions.origin)
44
+ list.push(serverOriginUrl.hostname)
45
+ } catch {}
46
}
47
48
return list
0 commit comments