Skip to content

Commit 5499a3d

Browse files
committed
Use baseUrl when redirecting from domain proxy
This will make the route more robust since it'll work under more than just the root.
1 parent 31b6706 commit 5499a3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/node/routes/domainProxy.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Request, Router } from "express"
22
import { HttpCode, HttpError } from "../../common/http"
3+
import { normalize } from "../../common/util"
34
import { authenticated, ensureAuthenticated, redirect } from "../http"
45
import { proxy } from "../proxy"
56
import { Router as WsRouter } from "../wsRouter"
@@ -54,8 +55,9 @@ router.all("*", (req, res, next) => {
5455
return next()
5556
}
5657
// Redirect all other pages to the login.
58+
const to = normalize(`${req.baseUrl}${req.path}`)
5759
return redirect(req, res, "login", {
58-
to: req.path !== "/" ? req.path : undefined,
60+
to: to !== "/" ? to : undefined,
5961
})
6062
}
6163

0 commit comments

Comments
 (0)