From 61611ba7f087b7897fbef8f6defb5232cfc784f1 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 1 Oct 2017 10:57:52 -0700 Subject: [PATCH] cmd/routed: only serve sites over https --- cmd/routed/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/routed/main.go b/cmd/routed/main.go index 2899bb4..8b5bde1 100644 --- a/cmd/routed/main.go +++ b/cmd/routed/main.go @@ -54,8 +54,11 @@ func main() { defer l.Close() hs := &http.Server{ - Handler: middleware.Trace(s), - Addr: scfg.WebAddr, + Handler: middleware.Trace(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + r.URL.Scheme = "https" + http.Redirect(w, r, r.URL.String(), http.StatusPermanentRedirect) + })), + Addr: scfg.WebAddr, } hs.Serve(l)