How to use SSL with OCSP with GIN Framework in Go

The GIN framework comes up with the SSL middleware autotls which requests the SSL certificate on request basis. However, it lacks the cool feature of OCSP

However, the CertMagic which generates SSL certificate during initializations – so no surprises here and does support OCSP.

app := gin.Default()

// Assuming SSL_DOMAIN has csv domains like,
domains := os.Getenv("SSL_DOMAIN")
domainsMap := strings.Split(domains, ",")
err := certmagic.HTTPS(domainsMap, app)
if err != nil {

Worth Sharing?


  1. The ssl is in memoery? What should we do when we want to move the servers and DNS is not propagated fully? I think it will induce a lot of down time. I am in Singapore.

  2. When I read the article, I thought that there would be nothing new probably but the argument against autotls package is certainly true. Now ssl seems to be quicker than autotls alone.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>