From 73118f845456d18a22dc652fbf240d4b955c4fc5 Mon Sep 17 00:00:00 2001 From: xion Date: Sat, 19 Oct 2024 12:33:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pathname=20=E6=9C=89search=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/module/index.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 699f748..46c6cad 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "type": "module", "scripts": { - "dev": "cross-env NODE_ENV=development nodemon --exec tsx src/index.ts", + "dev": "cross-env NODE_ENV=development nodemon --ignore upload --exec tsx src/index.ts", "build": "rimraf dist && rollup -c", "deploy": "rsync -avz dist/ light:~/apps/var-proxy/backend", "reload": "ssh light pm2 restart proxy", diff --git a/src/module/index.ts b/src/module/index.ts index 9e9c880..fd8e4c8 100644 --- a/src/module/index.ts +++ b/src/module/index.ts @@ -112,8 +112,10 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR app = data.app; } } - const url = req.url; - if (!domainApp && noProxyUrl.includes(req.url)) { + // const url = req.url; + const pathname = new URL(req.url, `http://${dns.hostName}`).pathname; + const url = pathname; + if (!domainApp && noProxyUrl.includes(url)) { res.write('No proxy for this URL\n'); return res.end(); }