From 26a32350c9de8af31244b254c08672d4ea8b83ca Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 1 Oct 2017 11:04:19 -0700 Subject: [PATCH] cmd/routed: log http redirects --- cmd/routed/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/routed/main.go b/cmd/routed/main.go index be3b2ef..f393d91 100644 --- a/cmd/routed/main.go +++ b/cmd/routed/main.go @@ -57,6 +57,9 @@ func main() { Handler: middleware.Trace(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { r.URL.Host = r.Host r.URL.Scheme = "https" + + ln.Log(r.Context(), ln.Action("redirecting insecure HTTP to HTTPS")) + http.Redirect(w, r, r.URL.String(), http.StatusPermanentRedirect) })), Addr: scfg.WebAddr,