diff --git a/kong/dns/utils.lua b/kong/dns/utils.lua index a197761af541..7560f3d69cc9 100644 --- a/kong/dns/utils.lua +++ b/kong/dns/utils.lua @@ -150,6 +150,7 @@ local function parse_resolv_conf(path, enable_ipv6) -- nameservers if resolv.nameserver then + local n = 0 local nameservers = {} for _, address in ipairs(resolv.nameserver) do @@ -157,7 +158,8 @@ local function parse_resolv_conf(path, enable_ipv6) if t == "ipv4" or (t == "ipv6" and not ip:find([[%]], nil, true) and enable_ipv6) then - table_insert(nameservers, port and { ip, port } or ip) + n = n + 1 + nameservers[n] = port and { ip, port } or ip end end