diff --git a/pkg/provider/acme/provider.go b/pkg/provider/acme/provider.go index 3b4c6d8458..47e3d731d8 100644 --- a/pkg/provider/acme/provider.go +++ b/pkg/provider/acme/provider.go @@ -552,8 +552,11 @@ func (p *Provider) resolveDefaultCertificate(ctx context.Context, domains []stri p.resolvingDomainsMutex.Lock() - sort.Strings(domains) - domainKey := strings.Join(domains, ",") + sortedDomains := make([]string, len(domains)) + copy(sortedDomains, domains) + sort.Strings(sortedDomains) + + domainKey := strings.Join(sortedDomains, ",") if _, ok := p.resolvingDomains[domainKey]; ok { p.resolvingDomainsMutex.Unlock() @@ -947,12 +950,14 @@ func (p *Provider) certExists(validDomains []string) bool { p.certificatesMu.RLock() defer p.certificatesMu.RUnlock() - sort.Strings(validDomains) + sortedDomains := make([]string, len(validDomains)) + copy(sortedDomains, validDomains) + sort.Strings(sortedDomains) for _, cert := range p.certificates { domains := cert.Certificate.Domain.ToStrArray() sort.Strings(domains) - if reflect.DeepEqual(domains, validDomains) { + if reflect.DeepEqual(domains, sortedDomains) { return true } }