mirror of
https://github.com/coder/code-server.git
synced 2024-12-26 19:23:16 +03:00
Use baseUrl when redirecting from domain proxy
This will make the route more robust since it'll work under more than just the root.
This commit is contained in:
parent
31b67062b0
commit
5499a3d125
@ -1,5 +1,6 @@
|
||||
import { Request, Router } from "express"
|
||||
import { HttpCode, HttpError } from "../../common/http"
|
||||
import { normalize } from "../../common/util"
|
||||
import { authenticated, ensureAuthenticated, redirect } from "../http"
|
||||
import { proxy } from "../proxy"
|
||||
import { Router as WsRouter } from "../wsRouter"
|
||||
@ -54,8 +55,9 @@ router.all("*", (req, res, next) => {
|
||||
return next()
|
||||
}
|
||||
// Redirect all other pages to the login.
|
||||
const to = normalize(`${req.baseUrl}${req.path}`)
|
||||
return redirect(req, res, "login", {
|
||||
to: req.path !== "/" ? req.path : undefined,
|
||||
to: to !== "/" ? to : undefined,
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user