Hi

I have a problem with the upstream round robin mechanism.
in ngx_http_upstream.c ngx_http_upstream_server function the hostname that is added in the configuration file under upstream directive is added to the upstream server list.
the function uses ngx_parse_url which in turn uses ngx_parse_inet_url that calls ngx_inet_resolve_host.
ngx_inet_resolve_host tries to resolve the host name from the configuration file by calling gethostbyname. for each url gethostbyname return the list of ip's that are associated with this url and these ip's are added to the list of upstream servers.
This results in a situation that if there are three servers defined in an upstream directive, each with an equal weight, but one of those server is associated with two ip's (for example internal and an external ip) then the round robin weight will not be equal for each server. The server which has two ip's will get a double weight.
i can add a log if required or if my explanation is not good enough.
i saw that a url has a flag called one_addr that if is set to true will get resolved to a single ip only, but this flag is not used.

adding the host ip address is one way to solve this, is there another way?