mirror of
https://github.com/caddyserver/caddy.git
synced 2026-07-11 03:14:19 +00:00
Use CertMagic's HTTP and HTTPS port variable
Slightly inconvenient because it uses int type and we use string, but oh well. This fixes a bug related to setting -http-port and -https-port flags which weren't being used by CertMagic in some cases.
This commit is contained in:
parent
6720bdfb55
commit
721c100bb0
3 changed files with 34 additions and 27 deletions
|
|
@ -25,6 +25,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"text/template"
|
||||
|
|
@ -33,6 +34,7 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/mholt/caddy/caddytls"
|
||||
"github.com/mholt/certmagic"
|
||||
"github.com/russross/blackfriday"
|
||||
)
|
||||
|
||||
|
|
@ -178,7 +180,7 @@ func (c Context) Port() (string, error) {
|
|||
if err != nil {
|
||||
if !strings.Contains(c.Req.Host, ":") {
|
||||
// common with sites served on the default port 80
|
||||
return HTTPPort, nil
|
||||
return strconv.Itoa(certmagic.HTTPPort), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue