openresty/lua-upstream-nginx-module

`get_primary_peers` returns `127.255.255.255` instead of name

paperpunk opened this issue · 1 comments

Hello,

I have upstreams defined like this:

http {
    resolver 1.2.3.4 ipv6=off; 
    
    upstream default {
      server default.hostname.net:8090;
    }
    
    upstream other {
      server other.hostname.net:1234;
    }
    ....
}

other.hostname.net is set up to resolve to 3 different IPs which shows up correctly:

upstream other:
    weight = 1, addr = {10.20.30.40:1234, 11.21.31.41:1234, 12.22.32.42:1234}, name = 127.255.255.255, fail_timeout = 10, max_fails = 1

But I am seeing name come up as 127.255.255.255 instead of other.hostname.net:1234. This is causing healthcheck to fail (I am using the lua-upstream-healthcheck module) because, instead of the 3 separate IPs, it sees the primary peers as 127.255.255.255 and fails to connect there with the following error:

connect() to 127.255.255.255:1234 failed (101: Network is unreachable), context: ngx.timer

Any idea why this may be happening? Do i need to provide a specific resolver for the get_primary_peers call?

Thank you.

@paperpunk nginx uses the system resolver (which respects /etc/hosts as well) for static domain names specified in the server directive inside upstream {}. You should check how your system resolver resolves your domains.