summaryrefslogtreecommitdiff
path: root/proxy.go
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-05-14 22:24:58 -0500
committersanine <sanine.not@pm.me>2023-05-14 22:24:58 -0500
commita2f7fd3070513941dded47a7ceb8afce75f337ce (patch)
treef84e71c6b0664bc1ad57743926f28da2511c948c /proxy.go
parent9a7b63bbc3cbce5ac469daf426da08a69c59bed4 (diff)
add permanent redirects for endpoints
Diffstat (limited to 'proxy.go')
-rw-r--r--proxy.go5
1 files changed, 5 insertions, 0 deletions
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)