Score:0

when doing request through nginx with domain as server_name, whenever i change the ip of the domain, it still redirects to previous ip

cn flag

I have a basic nginx as a reverse proxy which all it does is adding header to requests and proxy pass. I have there my domain as the server_block.

If lets say the environement fall, i want to change the ip of my domain, so everything will still work and i only have to change the ip of my domain and nothing more.

Now, whenever i change the ip of my domain, nginx still proxy to the old ip (which is down) and not the current ip. but whenever i redeploy the nginx, the problem is solved and it proxy to the current ip.

Now maybe it's some kind of cache or something like that, is there a way to cancel it?

br flag
Does this answer your question? [How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy\_pass?](https://serverfault.com/questions/240476/how-to-force-nginx-to-resolve-dns-of-a-dynamic-hostname-everytime-when-doing-p)
kevin avatar
cn flag
@AlexeyTen thanks, I'll try this, btw do you know what does this line means: resolver 127.0.0.1 [::1]:5353 valid=30s; . I tried to look for it but didn't understand. and do i also put localhost and port 5353, even if the nginx runs on another port?
br flag
https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver It’s address of DNS
kevin avatar
cn flag
@AlexeyTen so If my address is lets say 200.83.1.57 and im running on port 8080 I put 200.83.1.57 [::1]:8080; ? also if i have to do it, and lets say i then change the ip of the site, i have to update it right? - and it's not dynamic to ip change, and I do need it to be dynamic becuase i don't want to redeploy it when ip changes. or maybe setting a varaible for the proxy pass is good enough? what do you thing?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.