Machines Fail

Search

SearchSearch
Home

❯

til

Web Server with TLS in Go

Mar 10, 2024 | 55 words

  • #til
Source : https://x.com/mholt6/status/1756013624374730773
package main
 
import (
	"github.com/gin-gonic/autotls"
	"github.com/gin-gonic/autotls"
)
 
func main() {
	router := gin.Default()
	
	router.GET("/", func (c *gin.Context) {
		c.String(200, "Hello World!")
	}
 
	autotls.Run(router, "example.com")
}
// From Caddy's Author
 
certmagic.HTTPS([]string{"example .com"}, mux)

Also see:

  • Setting Up Vanity Subdomains for Your SaaS Using Next.js and Caddy
  • auto manage ssl/tls certificates in go (has AWS Route53 setup)

  • GitHub
  • Twitter
  • LinkedIn
  • Built with Quartz