diff --git a/server.go b/server.go index 89bf6d4d3..6f9c6ff9e 100644 --- a/server.go +++ b/server.go @@ -299,7 +299,10 @@ func (server *Server) createTLSConfig(entryPointName string, tlsOption *TLS, rou if _, ok := server.serverEntryPoints[server.globalConfiguration.ACME.EntryPoint]; ok { if entryPointName == server.globalConfiguration.ACME.EntryPoint { checkOnDemandDomain := func(domain string) bool { - if router.GetHandler().Match(&http.Request{URL: &url.URL{}, Host: domain}, &mux.RouteMatch{}) { + routeMatch := &mux.RouteMatch{} + router := router.GetHandler() + match := router.Match(&http.Request{URL: &url.URL{}, Host: domain}, routeMatch) + if match && routeMatch.Route != nil { return true } return false