@@ -152,3 +152,13 @@ func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
152 tc.SetKeepAlivePeriod(3 * time.Minute)
152 tc.SetKeepAlivePeriod(3 * time.Minute)
153 return tc, nil
153 return tc, nil
156+func redirectToHTTPS(opts *Options, h http.Handler) http.Handler {
157+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
158+ if opts.ForceHTTPS {
159+ http.Redirect(w, r, opts.HTTPSAddress, http.StatusPermanentRedirect)