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!