[TOC]
  • Support Let’s Encrypt

Support Let’s Encrypt

Example for 1-line LetsEncrypt HTTPS servers.

package mainimport (    "log"    "github.com/iris-gonic/autotls"    "github.com/kataras/iris/v12")func main() {    app := iris.Default()    // Ping handler    app.Get("/ping", func(ctx iris.Context) {        ctx.WriteString("pong")    })    app.Run(iris.AutoTLS(":443", "example.com example2.com", "mail@example.com"))}

Example for custom TLS (you can bind an autocert manager too):

app.Run(    iris.TLS(":443", "", "", func(su *iris.Supervisor) {        su.Server.TLSConfig = &tls.Config{            /* your custom fields */        },    }),)

All iris.Runner methods such as: Addr, TLS, AutoTLS, Server, Listener and e.t.c accept a variadic input argument of func(*iris.Supervisor) to configure the http server instance on build state.