cmd/routed: only serve sites over https

This commit is contained in:
Cadey Ratio 2017-10-01 10:57:52 -07:00
parent 9b0c00cefd
commit 61611ba7f0
No known key found for this signature in database
GPG Key ID: D607EE27C2E7F89A
1 changed files with 5 additions and 2 deletions

View File

@ -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)