tarantool / nginx_upstream_module

Tarantool NginX upstream module (REST, JSON API, websockets, load balancing)
Other
174 stars 18 forks source link

Allow variables in tnt_pass #140

Open ochaton opened 3 years ago

ochaton commented 3 years ago

We have dynamic balancer which discovers inside ngx.timer (from lua-nginx-module) upstreams of tarantool and balances client requests according to some application logic. We would like to configure tarantool location in the following way:

server {
    server_name _;

    location .tnt {
        internal;
        tnt_pass $tarantool;
    }

    location / {
        set $tarantool "placeholder";
        content_by_lua_block {
            for _, tnt in app:upstreams() do
                ngx.var.tarantool = tnt -- sets variable
                app:execute() -- performs internal request to .tnt
            end
        }
    }
}

We can't do this now, because tnt_pass requires IP address or upstream name