diff --git a/lib/resty/acme/autossl.lua b/lib/resty/acme/autossl.lua index a2dadb8..774702f 100644 --- a/lib/resty/acme/autossl.lua +++ b/lib/resty/acme/autossl.lua @@ -443,9 +443,8 @@ function AUTOSSL.ssl_certificate() elseif certkey == null then log(ngx_DEBUG, "negative cached domain cert") elseif certkey then - if chains_set_count == 0 then + if i == 1 then ssl.clear_certs() - chains_set_count = chains_set_count + 1 end chains_set[i] = true @@ -455,7 +454,9 @@ function AUTOSSL.ssl_certificate() end end - if domain_key_types_count ~= chains_set then + chains_set_count = #chains_set + + if domain_key_types_count ~= chains_set_count then ngx.timer.at(0, function() for i, typ in ipairs(domain_key_types) do if not chains_set[i] then