You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/18 09:06:13 UTC

[GitHub] [apisix] ShaoZeMing opened a new issue #4268: bug: Routing priority matching bug ++

ShaoZeMing opened a new issue #4268:
URL: https://github.com/apache/apisix/issues/4268


   @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)
   
   _Originally posted by @membphis in https://github.com/apache/apisix/issues/3865#issuecomment-803592575_
   
   
   
   Sorry, I'm here to bother you again. I did configure A and B according to the method in this document, but did not achieve the effect of B>A;


-- 
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:
users@infra.apache.org



[GitHub] [apisix] ShaoZeMing commented on issue #4268: bug: Routing priority matching bug ++

Posted by GitBox <gi...@apache.org>.
ShaoZeMing commented on issue #4268:
URL: https://github.com/apache/apisix/issues/4268#issuecomment-843002510


   B:
   
   ```
   {
       "id":"355335318611690311",
       "create_time":1621325954,
       "update_time":1621327457,
       "uris":[
           "/api/platform/knowledge/*"
       ],
       "name":"xthk-knowledge-center-pub-path-copy",
       "desc":"知识中心后台-api-临时",
       "priority":3,
       "methods":[
           "GET",
           "HEAD",
           "POST",
           "PUT",
           "DELETE",
           "OPTIONS",
           "PATCH"
       ],
       "hosts":[
           "knowledge-center-bms.aaa.cn"
       ],
       "vars":[
   
       ],
       "service_id":"343416638873273346",
       "upstream_id":"355334197423899463",
       "labels":{
           "API_VERSION":"v1.0.0"
       },
       "status":1
   }
   ```
   
   A:
   
   ```
   
   ```


-- 
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:
users@infra.apache.org



[GitHub] [apisix] ShaoZeMing closed issue #4268: bug: Routing priority matching bug ++

Posted by GitBox <gi...@apache.org>.
ShaoZeMing closed issue #4268:
URL: https://github.com/apache/apisix/issues/4268


   


-- 
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:
users@infra.apache.org