Open xBoo opened 1 month ago
APISIX doesn't support this.
I found an implementation, which is done through the following code: dymainc_uri_upstream.lua
local up_conf = {
timeout = {
connect = 6,
send = 300,
read = 300
},
scheme = "http",
type = "roundrobin",
pass_host = "pass",
keepalive_pool = {
idle_timeout = 60,
requests = 1000,
size = 320
},
hash_on = "vars",
nodes = {
{
priority = 0,
port = upstream_port,
host = parse_domain(upstream_host),
weight = 1
}
}
}
local ok, err = upstream.check_schema(up_conf)
if not ok then
core.log.error("failed to validate generated upstream: ", err)
return 500, err
end
local matched_route = ctx.matched_route
up_conf.parent = matched_route
local upstream_key = up_conf.type .. "#route_" .. matched_route.value.id
core.log.info("upstream_key: ", upstream_key)
upstream.set(ctx, upstream_key, ctx.conf_version, up_conf)
But I don't think it's a best practice because many parameters become fixed values and cannot be dynamically configured. I found that it can also be achieved by setting the upstream_id, but I don't know what the risks are.
APISIX doesn't support this. Dynamic routing based on user (token) information is crucial in a multi-cluster mode, and I hope APISIX can implement this.
Description
i got tenantid in jwt token, and i want to use this id to route the cluster, how can i do it ?
Environment
3.9.0
):uname -a
):openresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):