make redirects more ergonomic
1 file changed, 4 insertions(+), 4 deletions(-)
changed files
M internal/website/mux.go → internal/website/mux.go
@@ -212,7 +212,7 @@ return nil }, ) const oidcPath = "/.well-known/openid-configuration" - mux.Handle(oidcPath, http.RedirectHandler(cfg.OIDCHost.JoinPath(oidcPath).String(), 302)) + mux.Handle(oidcPath, ihttp.RedirectHandler(cfg.OIDCHost.JoinPath(oidcPath), 302)) website.config = cfg website.App.Handler = mux@@ -231,16 +231,16 @@ mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { switch { case slices.Contains(website.config.Domains, r.Host): path, _ := website.reader.CanonicalisePath(r.URL.Path) - http.Redirect( + ihttp.Redirect( w, r, - website.config.BaseURL.JoinPath(path).String(), + website.config.BaseURL.JoinPath(path), http.StatusMovedPermanently, ) case re.MatchString(r.Host): url := website.config.BaseURL.JoinPath() url.Host = re.ReplaceAllString(r.Host, replace) - http.Redirect(w, r, url.String(), http.StatusTemporaryRedirect) + ihttp.Redirect(w, r, url, http.StatusTemporaryRedirect) case true: http.NotFound(w, r) }