[GitHub] [apisix] membphis commented on issue #3865: bug: Routing priority matching bug

2021-03-21 Thread GitBox


membphis commented on issue #3865:
URL: https://github.com/apache/apisix/issues/3865#issuecomment-803592575


   @ShaoZeMing I listed an example to explain the reason.
   
   Here are three routes(A, B and C), what is their priority?  
   I think you can talk to me A < B, and A < C, it seems fine. 
   
   Between B and C, who has the highest priority? I think it is not easy to 
reply to this question.
   The machine cannot accurately determine who has the higher priority at this 
time. 
   
   ```
   ### router A:only uri
   {
   "uris":[ "/*" ]
   }
   
   ### router B :uri + host
   {
   "uris":["/*"],
   "hosts":["test-dev-1.apisix.xthktech.cn"]
   }
   
   ### router B : uri + header
   {
   "uris":["/*"],
   "vars":[
   [
   "http_app-name",
   "==",
   "test-header"
   ]
   ]
   }
   ```
   
   In APISIX, when the URI is the same, additional priority needs to be set. 
   Here is an example, then we know that: B > C > A.
   
   ```
   router A:only uri
   {
   "uris":[ "/*" ],
   "priority": 0
   }
   
   router B :uri + host
   {
   "uris":["/*"],
   "hosts":["test-dev-1.apisix.xthktech.cn"],
   "priority": 2
   }
   
   router C : uri + header
   {
   "uris":["/*"],
   "vars":[
   [
   "http_app-name",
   "==",
   "test-header"
   ]
   ],
   "priority": 1
   }
   ```
   
   *note*: the default value of `priority` is zero.
   
   
https://github.com/apache/apisix/blob/master/docs/en/latest/admin-api.md#route
   
![image](https://user-images.githubusercontent.com/6814606/111908745-52de6980-8a95-11eb-9bd1-211aef035309.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] membphis commented on issue #3865: bug: Routing priority matching bug

2021-03-19 Thread GitBox


membphis commented on issue #3865:
URL: https://github.com/apache/apisix/issues/3865#issuecomment-803225177


   this is not a bug. I confirmed.
   
   @ShaoZeMing the router `a`, `b`, `c` have same uri `/*` and `priority`, 
you'd better to specify a different `priority`.
   
   `/test/*` always matches before `/*`. The route `radixtree_uri` matching of 
apisix is depth-first. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org