apache / apache/apisix

feat: As a user, I want apisix to warn me if I have multiple routes that would match for the same URI

Open
#8,992 6 comments 3 reactions 0 assignees View on GitHub
discuss enhancement
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 16h
Merged PRs (30d)
63

Description

### Description

Example:

Route one:

```bash
curl -XPUT 127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -d '{
"uri":"/anything/*",
"plugins": {
.....
},
"upstream":{
"type":"roundrobin",
"nodes":{
"httpbin.org:80":1
}
}
}'
```

route two:

```bash
curl -XPUT 127.0.0.1:9180/apisix/admin/routes/2 -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -d '{
"uri":"/anything/*",
"plugins": {
.....
},
"upstream":{
"type":"roundrobin",
"nodes":{
"abc.org:80":1
}
}
}'
```
As you can see both routes have same URI.
In this case, APISIX would randomly match any route when I visit `127.0.0.1:9080/anything/test`.

I understand that this is the user's fault but if users receive a warning when they try to create a route that has a conflicting URI it would lead to a better UX.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named in the issue. Start by tracing route creation and URI matching in APISIX, then determine how identical or overlapping URIs are detected; done means creating a conflicting route produces a clear warning without preventing the route from being created, with coverage for the example behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.