From 578e1c9bc18236169b2ae616bc52a6e6a8a7d507 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Fri, 24 Feb 2023 18:49:46 +0200 Subject: [PATCH] [#223] updated the internal redirects to allow easier subpath deployment when behind a reverse proxy --- CHANGELOG.md | 2 ++ apis/base.go | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b13bc7c7..ee792e55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,8 @@ - **!** Removed the previously deprecated `Dao.Block()` and `Dao.Continue()` helpers in favor of `Dao.NonconcurrentDB()`. +- Updated the internal redirects to allow easier subpath deployment when behind a reverse proxy. + - Other minor Admin UI improvements. ## v0.12.3 diff --git a/apis/base.go b/apis/base.go index 0698554a..09d6d0b5 100644 --- a/apis/base.go +++ b/apis/base.go @@ -163,7 +163,7 @@ func bindStaticAdminUI(app core.App, e *echo.Echo) error { e.GET( strings.TrimRight(trailedAdminPath, "/"), func(c echo.Context) error { - return c.Redirect(http.StatusTemporaryRedirect, trailedAdminPath) + return c.Redirect(http.StatusTemporaryRedirect, strings.TrimLeft(trailedAdminPath, "/")) }, ) @@ -224,12 +224,12 @@ func installerRedirect(app core.App) echo.MiddlewareFunc { if totalAdmins == 0 && !hasInstallerParam { // redirect to the installer page - return c.Redirect(http.StatusTemporaryRedirect, trailedAdminPath+"?installer#") + return c.Redirect(http.StatusTemporaryRedirect, "?installer#") } if totalAdmins != 0 && hasInstallerParam { - // redirect to the home page - return c.Redirect(http.StatusTemporaryRedirect, trailedAdminPath+"#/") + // clear the installer param + return c.Redirect(http.StatusTemporaryRedirect, "?") } return next(c)