Hello i am using redis for store the ssl certificate here this is my conf below and i am getting this issue , multiple time in a day and it causing downtime in production

31 views
Skip to first unread message

Prateek mishra {pmis}

unread,
Jul 25, 2023, 2:27:52 AMJul 25
to openresty-en
ERROR>>  2372016#2372016: *795438 lua tcp socket connect timed out, when connecting to 104.21.69.251:443, context: ssl_certificate_by_lua*, client: 172.70.126.143, server: 0.0.0.0:443


CONF:

init_by_lua_block {
     auto_ssl = (require "resty.auto-ssl").new()
     auto_ssl:set("storage_adapter", "resty.auto-ssl.storage_adapters.redis")
     auto_ssl:set("redis", {
      host = "localhost",
      port = "6379",
      db = "0",
      prefix = "admin_ssl"
    })
     auto_ssl:set("renew_check_interval", 86400)
     auto_ssl:set("allow_domain", function(domain, auto_ssl, ssl_options, renewal)

        if domain == "admin..app" then
                return true
        end



         local http = require("resty.http")
         local httpc = http.new()

         httpc:set_timeout(10000)

        local uri = "https://api.app/tenant/validate?k-tenant=" .. domain

         local res, err = httpc:request_uri(uri, {
           ssl_verify = false,
           method = "GET"
         })

         if not res then
           return false
         end

         if res.status == 200 then
           return true
         end

         if res.status == 404 then
           return false
         end
    end)
    auto_ssl:init()
  }

Junlong li

unread,
Jul 29, 2023, 5:04:50 AMJul 29
to openresty-en
The error is in ssl_certificate_by_lua,  but the code you gived is  init_by_lua_block.
And I don't think lua-resty-http can work in this phase. Is there anything wrong?
Reply all
Reply to author
Forward
0 new messages