0

I have a hostname like this: https://abc.xyz.com

I want to force resolve the dns everytime a request arrives, because if the dns of abc.xyz.com changes i want nginx to still be able to proxy to the site, therefore need to resolve the dns again.

Now i followed this post How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass? and my configuration looks like this

server {
    ...
    resolver abc.xyz.com;
    set $backend "http://abc.xyz.com";
    proxy_pass $backend;
    ...
}

And i get this error [error] 9#9 recv() failed (111: connection refused) while resolving, resolver: <some-dns>:53

I don't understand what i'm doing wrong here, i guess it has something to do with the resolver. The only difference is that the guy in the post put dns there 127.0.0.1. I don't think i want to do that since dns/ip can change when i redploy my app and i saw you can give resolver a hostname but it doesn't work and i get this error.

Any help would be appreatiated!

kevin
  • 13
  • 5

1 Answers1

0

The resolver tells which DNS recursive server is used to resolve the domain name. You need to point it to your DNS server's IP address.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58