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:02:15 UTC

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

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


   > @ShaoZeMing我列出了一个示例来解释原因。
   > 
   > 这里有三条路线(`A`,`B`和`C`),什么是他们的优先级?
   > 我认为您可以和我`A`<`B`和`A`<交谈`C`,这似乎很好。
   > 
   > 在`B`和之间`C`,谁的优先级最高?我认为要回答这个问题并不容易。
   > 机器此时无法准确确定谁的优先级更高。
   > 
   > ```
   > ### 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"
   >         ]
   >     ]
   > }
   > ```
   > 
   > 在APISIX中,当URI相同时,需要设置其他优先级。
   > 这是一个示例,然后我们知道: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
   > }
   > ```
   > 
   > _注意_:的`priority`最大值零。
   > 
   > https://github.com/apache/apisix/blob/master/docs/en/latest/admin-api.md#route
   > ![图像](https://user-images.githubusercontent.com/6814606/111908745-52de6980-8a95-11eb-9bd1-211aef035309.png)
   
   
   > @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)
   
   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