Welcome! Log In Create A New Profile

Advanced

Re: nginx serving wrong proxy content, static assets not affected

Eduardo Kortright
January 06, 2023 03:48PM
On my staging server, I stopped container aaa (with IP address x.x.x.5); I then restarted container bbb (with IP address x.x.x.6); finally, I started aaa again. As expected, when bbb restarted it claimed aaa’s old IP address, since it was the lowest available address. When aaa started back up, it took bbb’s old IP, so they ended up swapping IP addresses, but nginx thinks they’re at their original locations.

Once again, thank you for your help with this. As I mentioned, I’m probably just going to make Docker assign fixed addresses to each container so that nginx can look up the names once.

If you are interested in that sort of thing, please leave an answer at https://serverfault.com/questions/1117412/nginx-serving-content-from-wrong-proxy and I’ll be happy to mark it correct.

I'll bet that's it! There is nothing in my configuration that makes the IP addresses of the containers in the Docker network stay fixed. I would not be surprised if, when two or more containers are restarted (as they probably are every once in a while when logrotate runs), some or all of them may exchange IP addresses.
I will try to duplicate this so I can post the results here, but in any case I will find out how to assign specific IP addresses to the containers in the Docker configuration and do that from now on. Your observation that nginx looks up the IP once and assumes it will not change would explain what is going on.
I can't thank you enough, as this was driving me crazy.
Thank you also for your other very helpful suggestions (reloading nginx instead of restarting, forcing DNS lookups).
Do the ip addresses for the rails sites change over time?Mind that nginx will query the hostname only once (at startup/reload),*and use that same ip forever*If the other containers switched ips, that would produce the exactbehavior that you are seeing.



_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx serving wrong proxy content, static assets not affected

Eduardo Kortright January 04, 2023 03:34PM

Re: nginx serving wrong proxy content, static assets not affected

unclepieman January 04, 2023 04:38PM

Re: nginx serving wrong proxy content, static assets not affected

Eduardo Kortright January 06, 2023 03:52PM

Re: nginx serving wrong proxy content, static assets not affected

Ángel January 05, 2023 07:36PM

Re: nginx serving wrong proxy content, static assets not affected

Eduardo Kortright January 05, 2023 08:56PM

Re: nginx serving wrong proxy content, static assets not affected

Eduardo Kortright January 06, 2023 03:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready