Can kong support request_uri with args support matches in path? #7292
Replies: 8 comments
-
Just checked the source code for router.lua, I guess the reason that not support request_uri with args support, because the cache mechanism for route match logic, that is really a good way to strip the args from request uri. But in our situation that is, we have to support the args matches. Just now I tried to re-write the router.lua, thinking if there is anyone to help me for a code review. thank you very much. The main way I just added another function find_route_ng with the additional parameter "orig_req_uri" passed, and only used for regex matches with uri mode; also disallow the cache setting. the only issue I currently know is, see below sample:
while both of them be matched at once, the point 1 would be route to service B by the reason of the cache key are same. see attached source code. BTW, the version of kong is: 1.4.0 |
Beta Was this translation helpful? Give feedback.
-
@mnteam, you are correct, we don't have arbitrary query parameter based routing. Though we did add |
Beta Was this translation helpful? Give feedback.
-
@bungle Hi Bungle, thank you for your response, I already changed the router.lua(see previous attached txt file) to support this feature, did the test and seems it is ok, but the bad news is: because of the uri based cache key generation, I have to disable the cache support for route find.( I see the header matches also disallow the cache, but confused if they have there are two same request uri but different head value, one of them have no header value matches, it should be an issue which would cause the incorrect route mapping) the next we will have a test scenario for the no cache route matches to see how it would be. |
Beta Was this translation helpful? Give feedback.
-
@mnteam great feedback! feel free to open a pull-request (or two if you think there is a bug in current header matching). |
Beta Was this translation helpful? Give feedback.
-
@bungle hi Bungle, seems I have no permission to create individual branch for pull request, and I did not see related reference about how to open a pull request with specified way, any hint? Thank you. for head matching of route, I do not think there is a way to simply resolve the issue, so my solution is disable the cache for route matching. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@bungle hi Bungle, sorry for the late reply, I just sent a pull request, please can you help to code review? the link is: #5347. Please inform me if there is any issue or I get the wrong understanding. |
Beta Was this translation helpful? Give feedback.
-
@mnteam thanks for pr, I am sure we will look at it soon, good stuff! |
Beta Was this translation helpful? Give feedback.
-
Hi, there is an issue for us to deploy kong, replace the nginx also for api gateway support.
currently we use location in nginx "server" phase, with $request_uri which matches the specified args pair for route,
but when we transfer the route method with kong, seems we can only match the request with the path( req_uri without args), so I'm confused is there a better way to implement or something I don't know which support already?
I checked the contribution reference doc but not sure how the restriction style for feature request, can anyone do help? Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions