Yes. I misunderstood one of the examples. It seemed like you could pass
an array of servers and have the module handle the rest, but it
obviously has to be handled manually.
I guess, it asks for a PR.
Thanks for clarification.
On 30/09/2018 23:35, Piotr Przybylski wrote:
> Please read the documentation, it works exactly as you need it to:
> https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md.
> balancer_by_lua is a callback called when nginx needs an upstream
> address, and it's your responsibility to set next tried address and stop
> conditions. That way you can easily implement various complex balancing
> schemes, different for each request.
>
> If your upstreams change frequently that is the way to go. If you rarely
> change them then it may be easier to dynamically generate nginx config -
> depending on the amount of Lua code you already have.