Hime can help to auto generate self-signed certificate for running https web server while development.
For example, to start https web server on port 8080
package main import ( "log" "net/http" "github.com/moonrhythm/hime" ) func main() { app := hime.New() app.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("ok")) })) app.Address(":8080") app.SelfSign(hime.SelfSign{}) log.Fatal(app.ListenAndServe()) }
For production, load a real certificate with app.TLS(certFile, keyFile) and pick a cipher-suite profile on the server's tls.Config:
app.TLS(certFile, keyFile)
tls.Config
app.Server().TLSConfig = hime.Modern() app.TLS("cert.pem", "key.pem")
hime.Restricted()
hime.Modern()
hime.Compatible()
Run a plain-HTTP server that redirects every request to its HTTPS URL:
go hime.StartHTTPSRedirectServer(":80")
There was an error while loading. Please reload this page.