From a2f7fd3070513941dded47a7ceb8afce75f337ce Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 14 May 2023 22:24:58 -0500 Subject: add permanent redirects for endpoints --- proxy.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'proxy.go') diff --git a/proxy.go b/proxy.go index 7be9419..4442fb9 100644 --- a/proxy.go +++ b/proxy.go @@ -31,6 +31,11 @@ func addEndpoint(s *auth.Sessions, pages page.Pages, e config.Endpoint) { Origin: origin, } + http.HandleFunc(e.Path, func(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Location", e.Path + "/") + w.WriteHeader(http.StatusPermanentRedirect) + }) + http.HandleFunc(e.Path + "/", func(w http.ResponseWriter, r *http.Request) { log.Infof("REQ: %v", r.URL.Path) proxy(w, r, s, pages, end) -- cgit v1.2.1