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
kong router prefix matching different behavior due to regex_priority #7687
Comments
That ... doesn't seem to be correct. ´regex_priority´ is used to disambiguate between two requests that both have regexes. In your example only one of them (route3) has regexes, so Could you please provide a full list of the calls you are using, so we can reproduce? Related: |
it can be easily reproduce on k8s
http request with kong_debug
|
there are 2 route rule.
route1:
{ "hosts": ["foo.com"], "paths": ["/"], "regex_priority": 1 }
route2:
{ "hosts": ["foo.com"] "paths": ["/v1"], "regex_priority": 0 }
the following request will route to route2, correct behavior due to prefix matching choosing longest length.
however, after adding another route things changed.
route3:
{ "hosts": ["bar.com"], "paths": ["/.*"], "regex_priority": 0 }
the same request will route to route1, which is an unexpected route behavior.
when I remove regex_priority from route1 and route2, the behavior is corret。
I think regex_priority cannot be used for routing rule sorting when using prefix matching which will sometimes make a mistake.
tested on Kong version 2.1.4
the behavior still exists on the latest version
The text was updated successfully, but these errors were encountered: