1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

web: Redirect base path prefix to prefix/ (#397)

Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
James Hillyerd
2023-09-13 12:18:08 -07:00
committed by GitHub
parent 5eb9592637
commit 63e47a4e74

View File

@@ -69,6 +69,9 @@ func NewServer(
log.Info().Str("module", "web").Str("phase", "startup").Str("path", redirectBase). log.Info().Str("module", "web").Str("phase", "startup").Str("path", redirectBase).
Msg("Base path configured") Msg("Base path configured")
Router.Path("/").Handler(http.RedirectHandler(redirectBase, http.StatusFound)) Router.Path("/").Handler(http.RedirectHandler(redirectBase, http.StatusFound))
// Redirect prefix when missing trailing slash.
Router.Path(prefix("")).Handler(http.RedirectHandler(redirectBase, http.StatusFound))
} }
// Dynamic paths. // Dynamic paths.