apache / apache/apisix

Enhance radixtree_uri_with_parameter to automatically differentiate literal segments from path parameters

Open
#13,439 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 16h
Merged PRs (30d)
63

Description

### Description

The current radixtree_uri_with_parameter router cannot distinguish a literal segment from a parameterised one. (APISIX version: 3.14.1)
For example, with the following routes:

GET /user/comn-language/:tenantId/all
GET /user/comn-language/:tenantId/:langId

and the request /user/comn-language/123/all, the router cannot determine accurately which route to match unless a priority field is manually set it picks the GET /user/comn-language/:tenantId/:langId route
The router should be enhanced with a built‑in precedence rule: a literal segment always wins over a parameter placeholder when both could match the same request.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the radixtree_uri_with_parameter router and reproduce the two routes with /user/comn-language/123/all. The work is done when a literal segment takes precedence over a parameter placeholder without manually setting priority, with a regression test covering the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.