cdn-up-and-running
cdn-up-and-running copied to clipboard
How to add multiple host dynamic by lua code.
I don't know if I got you right, but you can use Lua to add dynamically hosts using https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md . There is in even a consistent hashing implementation https://github.com/openresty/lua-resty-balancer
You can update a shared list of dynamic hosts by having a background Lua task polling the hosts/ips you need to use. You'll need to pay attention to how you deal with health check as well.
BEWARE on how nginx/lua resolves name.