From 97d47b7150ae75d855eb43c0c83e5d288a3765c1 Mon Sep 17 00:00:00 2001 From: Yusuf Kandemir Date: Tue, 29 Mar 2022 01:45:51 +0300 Subject: [PATCH] fix(app-vite): Correctly use WHATWG URL constructor Here is a lengthy discussion about the problem https://github.com/nodejs/node/issues/12682 --- app-vite/lib/modes/ssr/ssr-devserver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-vite/lib/modes/ssr/ssr-devserver.js b/app-vite/lib/modes/ssr/ssr-devserver.js index 7de927c9db8..e29767fad18 100644 --- a/app-vite/lib/modes/ssr/ssr-devserver.js +++ b/app-vite/lib/modes/ssr/ssr-devserver.js @@ -307,7 +307,7 @@ class SsrDevServer extends AppDevserver { const { publicPath } = this.#appOptions publicPath !== '/' && app.use((req, res, next) => { - const pathname = new URL(req.url).pathname || '/' + const pathname = new URL(req.url, `http://${request.headers.host}`).pathname || '/' if (pathname.startsWith(publicPath) === true) { next()