From bc738991b6234bf334855e1396919e79ef9791b8 Mon Sep 17 00:00:00 2001 From: Pascal Date: Mon, 14 Oct 2019 19:29:36 +0200 Subject: caddyhttp: Support placeholders in MatchHost (#2810) * Replace global placeholders in host matcher * caddyhttp: Fix panic on MatchHost tests --- modules/caddyhttp/caddyhttp.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules/caddyhttp/caddyhttp.go') diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index 191f803..5631b30 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -273,6 +273,8 @@ func (app *App) automaticHTTPS() error { // addresses to the routes that do HTTP->HTTPS redirects lnAddrRedirRoutes := make(map[string]Route) + repl := caddy.NewReplacer() + for srvName, srv := range app.Servers { srv.tlsApp = tlsApp @@ -294,6 +296,7 @@ func (app *App) automaticHTTPS() error { for _, m := range matcherSet { if hm, ok := m.(*MatchHost); ok { for _, d := range *hm { + d = repl.ReplaceAll(d, "") if certmagic.HostQualifies(d) && !srv.AutoHTTPS.Skipped(d, srv.AutoHTTPS.Skip) { domainSet[d] = struct{}{} -- cgit v1.2.3