19 ms·
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://
by Tenzer 11y ago
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 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.
- corobo 11y agoThe sibling comment to this pointed out the $host variable. I imagine something along the line of proxy_pass http://$host.internaldomain; http://$host.internaldomain; or something on that line. I'll have to look into it further :)
- sprobertson 11y agoLua + Redis is a nice way to do this, I have a small project https://github.com/spro/simon https://github.com/spro/simon that does dynamic routing and load balancing based on Hostname -> IP:Port sets in Redis. Adding a new route is as simple as: sadd backends:hnapi.dev 192.168.0.42:10555
- Tenzer 11y agoNeat! I want to get started on some Lua scripting as well, probably first to just get a bunch of metrics out of Nginx via StatsD. There's access to a whole bunch of numbers via Lua that you otherwise can't get out from the stub_status page.