Fixed base path

This commit is contained in:
2022-02-02 10:05:00 +01:00
parent a96d9b5c68
commit cac2111296
3 changed files with 18 additions and 11 deletions

View File

@@ -67,7 +67,13 @@ func setupFrontend(r *mux.Router) {
landingpage := template.Must(template.ParseFiles(filepath.Join(config.FrontendDir, "html", "landingpage.gohtml")))
r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
landingpage.Execute(w, config.PageBase)
basePath := r.URL.Scheme + "://" + config.BasePath
if r.URL.Scheme == "" {
basePath = "http" + basePath
}
landingpage.Execute(w, struct {
BasePath string
}{BasePath: basePath})
})
r.NotFoundHandler = http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {