We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dded82b commit 47d6d3aCopy full SHA for 47d6d3a
src/node/routes/pathProxy.ts
@@ -13,7 +13,13 @@ const getProxyTarget = (
13
): string => {
14
// If there is a base path, strip it out.
15
const base = (req as any).base || ""
16
- return `http://0.0.0.0:${req.params.port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}`
+ 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)}`
23
}
24
25
export async function proxy(
0 commit comments