Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request help: radixtree_host_uri does not consider routing priority #2423

Closed
haifeng9414 opened this issue Oct 14, 2020 · 4 comments · Fixed by #2447
Closed

request help: radixtree_host_uri does not consider routing priority #2423

haifeng9414 opened this issue Oct 14, 2020 · 4 comments · Fixed by #2447
Labels
bug Something isn't working

Comments

@haifeng9414
Copy link
Contributor

Issue description

Why does radixtree_host_uri.lua not set the priority when creating a route:

local radixtree_route = {
        paths = route.value.uris or route.value.uri,
        methods = route.value.methods,
        remote_addrs = route.value.remote_addrs
                       or route.value.remote_addr,
        vars = route.value.vars,
        filter_fun = filter_fun,
        handler = function (api_ctx)
            api_ctx.matched_params = nil
            api_ctx.matched_route = route
        end
    }

Is this a bug?

  • apisix version (cmd: apisix version): latest master(4f535e7)
@membphis
Copy link
Member

@haifeng9414
Copy link
Contributor Author

haifeng9414 commented Oct 16, 2020

@membphis
radixtree_uri.lua文件创建radixtree_router对象的时候设置了路由的priority属性,但是radixtree_host_uri.lua文件没有,如果我用radixtree_host_uri作为路由实现,配置两个域名和uri相同,优先级不同的路由,路由的优先级能起作用吗?
下面是两个文件创建radixtree_router对象的代码:

-- radixtree_uri.lua
core.table.insert(uri_routes, {
    paths = route.value.uris or route.value.uri,
    methods = route.value.methods,
    priority = route.value.priority, -- 这里设置了路由的优先级
    hosts = route.value.hosts or route.value.host,
    remote_addrs = route.value.remote_addrs
                   or route.value.remote_addr,
    vars = route.value.vars,
    filter_fun = filter_fun,
    handler = function (api_ctx)
        api_ctx.matched_params = nil
        api_ctx.matched_route = route
    end
})
-- radixtree_host_uri.lua
local radixtree_route = {
    paths = route.value.uris or route.value.uri,
    methods = route.value.methods,
    -- 这里没有设置路由的优先级
    remote_addrs = route.value.remote_addrs
                   or route.value.remote_addr,
    vars = route.value.vars,
    filter_fun = filter_fun,
    handler = function (api_ctx)
        api_ctx.matched_params = nil
        api_ctx.matched_route = route
    end
}

@membphis membphis added bug Something isn't working and removed discuss labels Oct 16, 2020
@membphis
Copy link
Member

@haifeng9414 many thx for your report. would you like to fix this issue?

@haifeng9414
Copy link
Contributor Author

@haifeng9414 many thx for your report. would you like to fix this issue?

Yes, I would

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants