Skip to content
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

fix: give more priority to longer routes #145

Merged

Conversation

shreemaan-abhishek
Copy link
Member

@shreemaan-abhishek shreemaan-abhishek commented Jan 19, 2024

Fixes apache/apisix#9366

Explanation:

when creating different routes that have a common prefix but are differentiated with a parameter, route matching becomes dependent on the registration order.

Consider the case:

uri for route_a: /api/:version/test/api/projects/:project_id/clusters/:cluster_id/nodes/?
uri for route_b: /api/:version/test/*subpath

path to be matched: /api/v4/test/api/projects/saas/clusters/123/nodes/

Theoretically, the above path should match route_a but due to the bug if route_b is registered before route_a, route_b will be matched

@shreemaan-abhishek shreemaan-abhishek merged commit 047275a into api7:master Jan 19, 2024
2 checks passed
@shreemaan-abhishek shreemaan-abhishek deleted the fix/common-prefix branch January 19, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants