Skip to content

Commit 47d6d3a

Browse files
authored
fix: parse part in path proxy (#7337)
1 parent dded82b commit 47d6d3a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/node/routes/pathProxy.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ const getProxyTarget = (
1313
): string => {
1414
// If there is a base path, strip it out.
1515
const base = (req as any).base || ""
16-
return `http://0.0.0.0:${req.params.port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}`
16+
let port: number
17+
try {
18+
port = parseInt(req.params.port, 10)
19+
} catch (err) {
20+
throw new HttpError("Invalid port", HttpCode.BadRequest)
21+
}
22+
return `http://0.0.0.0:${port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}`
1723
}
1824

1925
export async function proxy(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy