diff options
author | sanine <sanine.not@pm.me> | 2023-05-14 22:24:58 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-05-14 22:24:58 -0500 |
commit | a2f7fd3070513941dded47a7ceb8afce75f337ce (patch) | |
tree | f84e71c6b0664bc1ad57743926f28da2511c948c /proxy.go | |
parent | 9a7b63bbc3cbce5ac469daf426da08a69c59bed4 (diff) |
add permanent redirects for endpoints
Diffstat (limited to 'proxy.go')
-rw-r--r-- | proxy.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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) |