mirror of
https://github.com/cdr/code-server.git
synced 2025-12-06 00:14:08 +01:00
fix: parse part in path proxy (#7337)
This commit is contained in:
parent
dded82bb47
commit
47d6d3ada5
1 changed files with 7 additions and 1 deletions
|
|
@ -13,7 +13,13 @@ const getProxyTarget = (
|
|||
): string => {
|
||||
// If there is a base path, strip it out.
|
||||
const base = (req as any).base || ""
|
||||
return `http://0.0.0.0:${req.params.port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}`
|
||||
let port: number
|
||||
try {
|
||||
port = parseInt(req.params.port, 10)
|
||||
} catch (err) {
|
||||
throw new HttpError("Invalid port", HttpCode.BadRequest)
|
||||
}
|
||||
return `http://0.0.0.0:${port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}`
|
||||
}
|
||||
|
||||
export async function proxy(
|
||||
|
|
|
|||
Loading…
Reference in a new issue