-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
I have some trouble on route match #3134
Comments
Can you provide a minimal reproducible use case? |
GRPC serviceI use grpc build service
service code.
I run service with prot:9201, and use grpc-gateway provide http service. APISIXupstreams:
routes:
FactI send any post request with prefix /test/v1/files: , result is same with /test/v1/files:listReputationHistories ` |
The characters with |
Yes, /test/v1/files:/test/v1/files:listReputationHistories and /test/v1/files:xxxxxxx will return same results, even I don't define route with /test/v1/files:xxxxxxx. APISIX ignore characters behind ':' , only match string "/test/v1/files" before ':' |
See https://github.com/api7/lua-resty-radixtree#parameters-in-path, |
We need to fix it in lua-resty-radixtree. ":" is legal in uri and is recommended in RESTful API by Google: https://cloud.google.com/apis/design/custom_methods |
Added as api7/lua-resty-radixtree#82 |
Fix apache#3134. Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Fix apache#3134. You can still get the original behavior by set enable_parameter_in_route to true. Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Fix apache#3134. You can still get the original behavior by using radixtree_uri_with_parameter router. Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Issue description
I set two routes like this:
##route1
{"uris":["/test/v1/files/*"],"name":"get_file1","desc":"get_file1","methods":["GET"],"vars":[],"plugins":{"proxy-rewrite":{"regex_uri":["^/test/v1/files/(.+)","/v1/files/$1"]}},"upstream_id":"333773215308464216"}
##route2
{"uris":["/test/v1/files:listReputationHistories"],"name":"list_reputation_history1","methods":["POST"],"vars":[],"plugins":{"proxy-rewrite":{"uri":"/v1/files:listReputationHistories"}},"upstream_id":"333773215308464216"}
But run command:
curl "http://127.0.0.1:9080/test/v1/files:xxxdsadsadxxx" -XPOST -d {"uri":"xxx"}
, It also can return results.APISIX sames to match '/test/v1/files:xxxdsadsadxxx' to '"/test/v1/files:listReputationHistories'. I also try other cases:
curl "http://127.0.0.1:9080/test/v1/files: {any string}" -XPOST -d {"uri":"xxx"}
, APISIX sames ignore string behind ':'.Environment
2.1
):The text was updated successfully, but these errors were encountered: