0

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?

4
  • Does this answer your question? How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass? Commented Nov 2, 2021 at 12:44
  • @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? Commented Nov 2, 2021 at 19:01
  • nginx.org/en/docs/http/ngx_http_core_module.html#resolver It’s address of DNS Commented Nov 2, 2021 at 19:21
  • @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? Commented Nov 2, 2021 at 20:24

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.