// RunDemoHTTPSServer to demo a working example
RunDemoHTTPSServer to demo a working example
// RunDemoHTTPSServer to demo a working example
func RunDemoHTTPSServer(domain string, HSTS bool) (s *http.Server) {
	s = GetHTTPSServer(domain)
	mux := http.NewServeMux()
	mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
		if HSTS {
			w.Header().Add("Strict-Transport-Security", "max-age=3600")
		}
		w.Write([]byte("This is an example server on " + domain + ".\n"))
	})
	s.Handler = mux
	log.Fatal(s.ListenAndServeTLS("", ""))
	return
}
func RunDemoHTTPSServer ( domain string , HSTS bool ) ( s * http . Server ) { s = GetHTTPSServer ( domain ) mux := http . NewServeMux ( ) mux . HandleFunc ( " " , func ( w http . ResponseWriter , req * http . Request ) { if HSTS { w . Header ( ) . Add ( " " , " " ) } w . Write ( [ ] byte ( " " + domain + " \n " ) ) } ) s . Handler = mux log . Fatal ( s . ListenAndServeTLS ( " " , " " ) ) return }
RunDemoHTTPSServer to demo a working example
RunDemoHTTPSServer to demo a working example
// Recommend HTTPS only for the next hour (just an example) // Or for 1 year (also on all subdomains) // w.Header().Add("Strict-Transport-Security", "max-age=31536000; includeSubDomains")