func ensureCanonicalHost(h http.Handler) http.Handler {
	listenHostPort := fmt.Sprintf("%s:%d", listenHost, listenPortHTTPS)
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.Host != listenHost && r.Host != listenHostPort {
			log.Println(r.Host, "doesnt equal", listenHost, "or", listenPortHTTPS)
			redirectToCanonicalHost(w, r)
			return
		}
		h.ServeHTTP(w, r)
	})
}
// ensureCanonicalHost decorates a http.Handler, ensuring that the
// request being served is on the canonical hostname.
ensureCanonicalHost decorates a http.Handler, ensuring that the
request being served is on the canonical hostname.
// ensureCanonicalHost decorates a http . Handler ensuring that the // request being served is on the canonical hostname .
func ensureCanonicalHost(h http.Handler) http.Handler {
	listenHostPort := fmt.Sprintf("%s:%d", listenHost, listenPortHTTPS)
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.Host != listenHost && r.Host != listenHostPort {
			log.Println(r.Host, "doesnt equal", listenHost, "or", listenPortHTTPS)
			redirectToCanonicalHost(w, r)
			return
		}
		h.ServeHTTP(w, r)
	})
}
func ensureCanonicalHost ( h http . Handler ) http . Handler { listenHostPort := fmt . Sprintf ( " " , listenHost , listenPortHTTPS ) return http . HandlerFunc ( func ( w http . ResponseWriter , r * http . Request ) { if r . Host != listenHost && r . Host != listenHostPort { log . Println ( r . Host , " " , listenHost , " " , listenPortHTTPS ) redirectToCanonicalHost ( w , r ) return } h . ServeHTTP ( w , r ) } ) }
ensureCanonicalHost decorates a http.Handler, ensuring that the
request being served is on the canonical hostname.
ensureCanonicalHost decorates a http . Handler ensuring that the request being served is on the canonical hostname .