Skip to content

Commit 7b1b4fe

Browse files
committed
acme/autocert: make host of TLS certificate to be obtained always lowercase
1 parent 88737f5 commit 7b1b4fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

acme/autocert/autocert.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type HostPolicy func(ctx context.Context, host string) error
6565
func HostWhitelist(hosts ...string) HostPolicy {
6666
whitelist := make(map[string]bool, len(hosts))
6767
for _, h := range hosts {
68-
whitelist[h] = true
68+
whitelist[strings.ToLower(h)] = true
6969
}
7070
return func(_ context.Context, host string) error {
7171
if !whitelist[host] {
@@ -236,7 +236,7 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate,
236236
return nil, errors.New("acme/autocert: Manager.Prompt not set")
237237
}
238238

239-
name := hello.ServerName
239+
name := strings.ToLower(hello.ServerName)
240240
if name == "" {
241241
return nil, errors.New("acme/autocert: missing server name")
242242
}

0 commit comments

Comments
 (0)