Lesson 46 of 60
GoBuilding a HTTP/2 Server with TLS
20 minutes
Course progress77%
HTTP/2 + TLS
This lesson explains the main concept clearly with beginner-friendly examples and background so you can learn why the code works.
Go enables HTTP/2 automatically when serving over TLS.
cert, _ := tls.LoadX509KeyPair("server.crt", "server.key")
server := &http.Server{
Addr: ":443",
Handler: mux,
TLSConfig: &tls.Config{MinVersion: tls.VersionTLS12},
}
log.Fatal(server.ListenAndServeTLS(, ))