From 896dc6bc690bce51884bd43da91180882ce90cab Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 15 Feb 2018 08:48:05 -0700 Subject: [PATCH] tls: Try empty name if no matches for getting config during handshake See discussion on #2015; the initial change had removed this check, and I can't remember why I removed it or if it was accidental. Anyway, it's back now. --- caddytls/handshake.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/caddytls/handshake.go b/caddytls/handshake.go index 2f3f34af3..841d06cd0 100644 --- a/caddytls/handshake.go +++ b/caddytls/handshake.go @@ -59,6 +59,14 @@ func (cg configGroup) getConfig(name string) *Config { } } + // try a config that serves all names (this + // is basically the same as a config defined + // for "*" -- I think -- but the above loop + // doesn't try an empty string) + if config, ok := cg[""]; ok { + return config + } + // no matches, so just serve up a random config for _, config := range cg { return config