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:
[email protected]


Reply via email to