summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/caddyhttp.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r--modules/caddyhttp/caddyhttp.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index 94b2eee..6ad70f5 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -29,6 +29,7 @@ import (
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/modules/caddytls"
+ "github.com/caddyserver/certmagic"
"github.com/lucas-clemente/quic-go/http3"
"go.uber.org/zap"
)
@@ -112,6 +113,10 @@ type App struct {
// affect functionality.
Servers map[string]*Server `json:"servers,omitempty"`
+ // DefaultSNI if set configures all certificate lookups to fallback to use
+ // this SNI name if a more specific certificate could not be found
+ DefaultSNI string `json:"default_sni,omitempty"`
+
servers []*http.Server
h3servers []*http3.Server
h3listeners []net.PacketConn
@@ -145,8 +150,10 @@ func (app *App) Provision(ctx caddy.Context) error {
repl := caddy.NewReplacer()
+ certmagic.Default.DefaultServerName = app.DefaultSNI
+
// this provisions the matchers for each route,
- // and prepares auto HTTP->HTTP redirects, and
+ // and prepares auto HTTP->HTTPS redirects, and
// is required before we provision each server
err = app.automaticHTTPSPhase1(ctx, repl)
if err != nil {