mirror of
https://github.com/coder/code-server.git
synced 2025-09-19 12:28:49 +08:00
fix: parse part in path proxy (#7337)
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user