Archived
1
0

Fix proxying non-ASCII (#6154)

This only affects the path proxy since `req.originalUrl` is in escaped format.
This commit is contained in:
smalllady
2023-04-26 03:41:33 +08:00
committed by GitHub
parent 2e17735795
commit 951d8ac45e
2 changed files with 12 additions and 1 deletions

View File

@ -11,7 +11,7 @@ const getProxyTarget = (req: Request, passthroughPath?: boolean): string => {
return `http://0.0.0.0:${req.params.port}/${req.originalUrl}`
}
const query = qs.stringify(req.query)
return `http://0.0.0.0:${req.params.port}/${req.params[0] || ""}${query ? `?${query}` : ""}`
return encodeURI(`http://0.0.0.0:${req.params.port}${req.params[0] || ""}${query ? `?${query}` : ""}`)
}
export async function proxy(