mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-26 04:59:57 +08:00
v2: Implement 'pki' app powered by Smallstep for localhost certificates (#3125)
* pki: Initial commit of PKI app (WIP) (see #2502 and #3021) * pki: Ability to use root/intermediates, and sign with root * pki: Fix benign misnamings left over from copy+paste * pki: Only install root if not already trusted * Make HTTPS port the default; all names use auto-HTTPS; bug fixes * Fix build - what happened to our CI tests?? * Fix go.mod
This commit is contained in:
@ -25,11 +25,9 @@ import (
|
||||
|
||||
"github.com/caddyserver/caddy/v2"
|
||||
"github.com/caddyserver/caddy/v2/caddyconfig"
|
||||
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
|
||||
caddycmd "github.com/caddyserver/caddy/v2/cmd"
|
||||
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
|
||||
"github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
|
||||
"github.com/caddyserver/certmagic"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -67,7 +65,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
|
||||
changeHost := fs.Bool("change-host-header")
|
||||
|
||||
if from == "" {
|
||||
from = "localhost:" + httpcaddyfile.DefaultPort
|
||||
from = "localhost:443"
|
||||
}
|
||||
|
||||
// URLs need a scheme in order to parse successfully
|
||||
@ -129,11 +127,9 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
|
||||
}
|
||||
}
|
||||
|
||||
listen := ":80"
|
||||
listen := ":443"
|
||||
if urlPort := fromURL.Port(); urlPort != "" {
|
||||
listen = ":" + urlPort
|
||||
} else if certmagic.HostQualifies(urlHost) {
|
||||
listen = ":443"
|
||||
}
|
||||
|
||||
server := &caddyhttp.Server{
|
||||
|
Reference in New Issue
Block a user