Nginx with dynamic upstreams
tenzer.dk
Nginx with dynamic upstreams
1–10 of 55 posts
Re: Nginx with dynamic upstreams
#2Oddly enough I'd never really considered nginx for the job despite using it to reverse proxy elsewhere. Sometimes you just need a poke in the right direction :)
Now I just need to figure a way to specify *.internaldomain so that nginx resolves www.example.com.internaldomain - where www.example.com is grabbed from the requested Host: header
Re: Nginx with dynamic upstreams
#3Thank you for this, it's a decent start for me personally. I was previously using the DNS director in Varnish 3.x to do this which was removed in 4.x. The longer time goes on the more risk it is to be running older software so this has been a great help. Oddly enough I'd never really considered nginx for the job despite using it to reverse proxy elsewhere. Sometimes you just need a poke in the right direction :) Now…
I know you can use a map in Nginx to do what you ask for, as long as you have a list of domains already: http://nginx.org/en/docs/http/ngx_http_map_module.html#map. I can only imagine it also being possible to make fully dynamic, I just don't have a clear way of doing it in mind right now.
Re: Nginx with dynamic upstreams
#4Thank you for this, it's a decent start for me personally. I was previously using the DNS director in Varnish 3.x to do this which was removed in 4.x. The longer time goes on the more risk it is to be running older software so this has been a great help. Oddly enough I'd never really considered nginx for the job despite using it to reverse proxy elsewhere. Sometimes you just need a poke in the right direction :) Now…
See: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_... And: http://stackoverflow.com/a/15414811
Always be careful with user input though.
Re: Nginx with dynamic upstreams
#5Thank you for this, it's a decent start for me personally. I was previously using the DNS director in Varnish 3.x to do this which was removed in 4.x. The longer time goes on the more risk it is to be running older software so this has been a great help. Oddly enough I'd never really considered nginx for the job despite using it to reverse proxy elsewhere. Sometimes you just need a poke in the right direction :) Now…
You can use the $host variable See: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_... And: http://stackoverflow.com/a/15414811 Always be careful with user input though.
Of course rigorous testing before going live, but it gives options. I love options :)
Re: Nginx with dynamic upstreams
#6Thank you for this, it's a decent start for me personally. I was previously using the DNS director in Varnish 3.x to do this which was removed in 4.x. The longer time goes on the more risk it is to be running older software so this has been a great help. Oddly enough I'd never really considered nginx for the job despite using it to reverse proxy elsewhere. Sometimes you just need a poke in the right direction :) Now…
It's good to hear it was of use to somebody :) I know you can use a map in Nginx to do what you ask for, as long as you have a list of domains already: http://nginx.org/en/docs/http/ngx_http_map_module.html#map . I can only imagine it also being possible to make fully dynamic, I just don't have a clear way of doing it in mind right now.
I'll have to look into it further :)
Re: Nginx with dynamic upstreams
#7Re: Nginx with dynamic upstreams
#8Am I wrong for thinking that failure to honor the TTL in the first place is a bug?
Re: Nginx with dynamic upstreams
#9Am I wrong for thinking that failure to honor the TTL in the first place is a bug?
But this is not just nginx's fault. It's also Bad Design on the part of AWS because switching IP addresses this way means you can't keep a TCP socket open to an ELB machine for more than 60 seconds at a time because you never know when the routing rug is going to be yanked out from under you. This makes ELB useless for anything involving a persistent connection. No websockets for you!
Re: Nginx with dynamic upstreams
#10Am I wrong for thinking that failure to honor the TTL in the first place is a bug?
Ideally I would have like it to be an option though, instead of it basically having become a feature in Nginx Plus - if it wasn't for the way I described in the post.