haifeng9414 edited a comment on issue #2423:
URL: https://github.com/apache/apisix/issues/2423#issuecomment-709688380
@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
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]