Open wklken opened 11 months ago
and If I change the code, encode the uri before pass it to uri_router.dispatch
, it works
apisix/http/route.lua
function _M.match_uri(uri_router, match_opts, api_ctx)
core.table.clear(match_opts)
match_opts.method = api_ctx.var.request_method
match_opts.host = api_ctx.var.host
match_opts.remote_addr = api_ctx.var.remote_addr
match_opts.vars = api_ctx.var
match_opts.matched = core.tablepool.fetch("matched_route_record", 0, 4)
-- local ok = uri_router:dispatch(api_ctx.var.uri, match_opts, api_ctx, match_opts)
-- should always be encoded here
local ok = uri_router:dispatch(core.utils.uri_safe_encode(api_ctx.var.uri), match_opts, api_ctx, match_opts)
return ok
end
It's a bug or feature?
Can you raise a PR with this fix? This should be a valid fix if no other tests fail.
Description
use
then register a route like
/api/test/prod/cn/:word/
then
will got 404;
set the log level to debug, and add some log
and
and the resty/radixtree.lua
So, why use a decoded uri to call
uri_router:dispatch
, while the resty/radixtree.lua require a encoded uri?Environment
apisix version
): 3.2.1uname -a
):openresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):