From 626aeb50e809e42e7d13b3480f691f610973bd66 Mon Sep 17 00:00:00 2001 From: Thiago Padilha Date: Wed, 27 Sep 2023 17:32:48 -0300 Subject: [PATCH] Redirect "/" to vivo base path When vivo base path is different than "/" (root path), setup a redirect handler in the golang proxy. Close #205 --- packages/service/vivo.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/service/vivo.go b/packages/service/vivo.go index 41be24e8e..f76df4ae0 100644 --- a/packages/service/vivo.go +++ b/packages/service/vivo.go @@ -50,6 +50,10 @@ func VivoListen(frontendStaticDir string, basePath string) { basePath += "/" fs := http.StripPrefix(basePath, http.FileServer(http.Dir(frontendStaticDir))) http.Handle(basePath, fs) + if basePath != "/" { + // redirect "/" to base path + http.Handle("/", http.RedirectHandler(basePath, http.StatusSeeOther)) + } http.HandleFunc(basePath+"logs", vivoForward) http.HandleFunc(basePath+"metrics", vivoForward) http.HandleFunc(basePath+"traces", vivoForward)