title: Deploy golang martini HTTPS on Heroku server
body: <p>I am trying to deploy an HTTPS web side on Heroku using <a href="https://github.com/go-martini/martini" rel="nofollow">Golang-martini</a>.</p>
  
  <p>Here is the list I already done:</p>
  
  <ul>
  <li>I already enable SSL endpoint in Heroku. (it is paid plugin services)</li>
  <li><p>I already purchase my CA certificate key and it could be deploy Heroku. So, <code>heroku certs</code> shows: (note: the company name/endpoint address change)</p>
  
  <hr>
  
  <p>Endpoint  ||                 Common Name(s)  ||    Expires        ||       Trusted</p>
  
  <hr>
  
  <p>xxx.herokussl.com || server.sample.com ||  2016-05-25 23:59 UTC  || True</p></li>
  </ul>
  
  <p>And here is my code sample in Golang.</p>
  
  <pre><code>m := martini.Classic()
  martini.Env = martini.Prod
  m.Use(secure.Secure(secure.Options{
      SSLRedirect: false,
  }))
  
  
  //Because I want to keep HTTP and HTTPs enable.
  go func() {
      if err := http.ListenAndServe(":"+os.Getenv("PORT"), m); err != nil {
          log.Println(err)
      }
  }()
  
  // HTTPS: 
  if err := http.ListenAndServeTLS(":443", "server.crt", "server.key", m); err != nil {
      log.Println(err)
  }
  </code></pre>
  
  <p>Here are the my Questions:</p>
  
  <ul>
  <li><p>If I set the <code>ListenAndServeTLS</code> port in 8443 (or something else) it will show error when I trying to test with <code>curl -vI https://server.sample.com</code>. It will show error as: </p>
  
  <p>"curl: (60) SSL certificate problem: Invalid certificate chain"</p></li>
  <li><p>If I set the <code>ListenAndServeTLS</code> port to 443, it will show:</p>
  
  <p>"listen tcp :443: bind: permission denied"</p></li>
  </ul>
  
  <p>Please advise how I deploy HTTPs with Go-martini on Heroku, thanks..</p>