mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-21 06:16:31 -04: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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user