Re:Avoiding the top Nginx configuration mistakes
by cyounkins on Tuesday February 22, 2022 @11:03PM
(#30437449)
This issue has bitten me multiple times. You must set the resolver AND use the domain name in a variable. See here: https://www.nginx.com/blog/dns-service-discovery-nginx-plus/ under "Setting the Domain Name in a Variable". The other options ignore the record TTL or require Nginx Plus.
More details here: https://github.com/DmitryFillo/nginx-proxy-pitfalls
Re:Avoiding the top Nginx configuration mistakes
by nemothekid on Tuesday February 22, 2022 @11:58PM
(#30437844)
This x1000. This is why it always bites me; I know there's some magic incantation, but I always forget the one or the other; and you never notice until it causes downtime. The git repo is a huge help.
Re:Avoiding the top Nginx configuration mistakes
by mholt on Wednesday February 23, 2022 @02:04AM
(#30438487)
Hey, thanks for writing Caddy's advanced reverse proxy code years ago. I still used it as a model for Caddy 2's new reverse proxy.
Re:Avoiding the top Nginx configuration mistakes
by nemothekid on Wednesday February 23, 2022 @03:11AM
(#30438828)
Caddy has come a long way since then! When my previous company switched to Caddy this issue was actually one of the motivating factors to adopting Caddy at the time (and I'm pretty sure Caddy 2 is in use today). I still mainly use Caddy over nginx (except where I'm running a no-frills debian system).
This post actually means a lot because Caddy became so popular that (1) I assumed whatever I had written had been completely scrapped and forgotten and (2) no one would ever believe me that I made a big contribution "before Caddy was popular". It's one of the projects I'm so happy to see has come so far.
Re:Avoiding the top Nginx configuration mistakes
by mholt on Wednesday February 23, 2022 @08:49PM
(#30449319)
Ha, that's cool. Yeah, we still have the basic for loop that does upstream selection and load balancing, with the same timeout configs, etc. It's come a long way since then like you said, but I still consider Caddy 2's reverse proxy a derivative of your contribution from, like, week 3 of Caddy v1.
Re:Avoiding the top Nginx configuration mistakes
by egberts1 on Tuesday February 22, 2022 @11:56PM
(#30437831)
NGINX Plus? That’s a thing? Sheesh. what a business model.
Re:Avoiding the top Nginx configuration mistakes
by amdelamar on Tuesday February 22, 2022 @10:39PM
(#30437296)
This is my top issue with open-source nginx. Nginx plus has the solution though with its `resolver` directive. https://docs.nginx.com/nginx/admin-guide/load-balancer/http-...
Re:Avoiding the top Nginx configuration mistakes
by megous on Wednesday February 23, 2022 @03:38AM
(#30439022)
Opensource nginx has the same resolver directive.
I don't know why it happens to me so often, but I will set up nginx containers that proxy to some load balanced service (via DNS), and then one day the IPs will change and that service would break because I forgot to set resolver.