mirror of https://git.tuxpa.in/a/code-server.git
Proxy to 0.0.0.0 instead of localhost
This commit is contained in:
parent
f2f1fee6f1
commit
1067507c41
|
@ -80,7 +80,7 @@ router.all("*", (req, res, next) => {
|
||||||
|
|
||||||
proxy.web(req, res, {
|
proxy.web(req, res, {
|
||||||
ignorePath: true,
|
ignorePath: true,
|
||||||
target: `http://127.0.0.1:${port}${req.originalUrl}`,
|
target: `http://0.0.0.0:${port}${req.originalUrl}`,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -95,6 +95,6 @@ router.ws("*", (socket, head, req, next) => {
|
||||||
|
|
||||||
proxy.ws(req, socket, head, {
|
proxy.ws(req, socket, head, {
|
||||||
ignorePath: true,
|
ignorePath: true,
|
||||||
target: `http://127.0.0.1:${port}${req.originalUrl}`,
|
target: `http://0.0.0.0:${port}${req.originalUrl}`,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,9 +9,9 @@ export const router = Router()
|
||||||
const getProxyTarget = (req: Request, rewrite: boolean): string => {
|
const getProxyTarget = (req: Request, rewrite: boolean): string => {
|
||||||
if (rewrite) {
|
if (rewrite) {
|
||||||
const query = qs.stringify(req.query)
|
const query = qs.stringify(req.query)
|
||||||
return `http://127.0.0.1:${req.params.port}/${req.params[0] || ""}${query ? `?${query}` : ""}`
|
return `http://0.0.0.0:${req.params.port}/${req.params[0] || ""}${query ? `?${query}` : ""}`
|
||||||
}
|
}
|
||||||
return `http://127.0.0.1:${req.params.port}/${req.originalUrl}`
|
return `http://0.0.0.0:${req.params.port}/${req.originalUrl}`
|
||||||
}
|
}
|
||||||
|
|
||||||
router.all("/(:port)(/*)?", (req, res) => {
|
router.all("/(:port)(/*)?", (req, res) => {
|
||||||
|
|
Loading…
Reference in New Issue