*: allows for BASE_PATH configuration

This should unblock users who'd like to run the UI under a subpath on an existing vhost of their reverse proxy.
This is far from behind the most pretty/smart way to do it, but it works for all intent and purposes.
Fixes https://github.com/ngoduykhanh/wireguard-ui/issues/37
This commit is contained in:
Quentin Machu 2022-04-10 20:01:46 +08:00
parent a667efaa19
commit 63f88ab63d
12 changed files with 97 additions and 78 deletions

View file

@ -53,7 +53,7 @@ func Login(db store.IStore) echo.HandlerFunc {
// TODO: refresh the token
sess, _ := session.Get("session", c)
sess.Options = &sessions.Options{
Path: "/",
Path: util.BasePath,
MaxAge: 86400,
HttpOnly: true,
}
@ -82,7 +82,7 @@ func Login(db store.IStore) echo.HandlerFunc {
func Logout() echo.HandlerFunc {
return func(c echo.Context) error {
clearSession(c)
return c.Redirect(http.StatusTemporaryRedirect, "/login")
return c.Redirect(http.StatusTemporaryRedirect, util.BasePath + "/login")
}
}