0

We have this code in our NGINX config

proxy_pass https://api.company.com/xxxx/prod/public/v1/retrieve

The https://api.company.com as a load balancer which calls either server1 or server2.

But NGINX seems to be calling server1 or server2 with an actual IP address.

How does NGINX know the IP address of server1 or server2?

fastcodejava
  • 39,895
  • 28
  • 133
  • 186
  • 1
    The DNS lookup is performed once, so round robin DNS will not work. You could try [this technique](https://serverfault.com/a/593003/316685) to get Nginx to perform DNS lookup for each request, or define the load balancer in an [`upstream`](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream) block. – Richard Smith Feb 18 '20 at 08:17
  • 1
    nginx implements its own non-blocking name resolving, read [this](https://stackoverflow.com/questions/40330704/what-does-the-resolver-param-in-nginx-do/40331256#40331256) answer for more details. – Ivan Shatsky Feb 18 '20 at 09:49

0 Answers0