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/04/06 06:16:45 UTC
[GitHub] [apisix] Firstsawyou opened a new pull request #3987: docs: add more example about how to use the router radixtree-uri
Firstsawyou opened a new pull request #3987:
URL: https://github.com/apache/apisix/pull/3987
close #3873
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
### Pre-submission checklist:
* [x] Did you explain what problem does this PR solve? Or what new features have been added?
* [ ] Have you added corresponding test cases?
* [ ] Have you modified the corresponding document?
* [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) 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:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r608274953
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,98 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same `uri`
+
+When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
Review comment:
Need to quote the `uri`.
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -75,7 +75,7 @@ Here are the rules:
When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
-Note: In matching rules, the `priority` field takes precedence over other rules. Therefore, we can set other matching rules only when the value of the `priority` field is the same.
+Note: In matching rules, the `priority` field takes precedence over other rules.
Review comment:
We should mention that the `other rules` don't include the `uri` rule.
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607706467
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -116,9 +118,9 @@ curl http://127.0.0.1:1980/hello
All requests only hit the route of port `1980`.
-2. Different routes have the same uri and set different matching conditions
+2. Different routes have the same `uri` and set `different matching conditions`
Review comment:
In order to highlight this category of content, I quoted it.
--
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] spacewander commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607570179
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,96 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same uri
Review comment:
We should quote the `uri`, as we mean a field of Route instead of URI.
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,96 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same uri
+
+When different routes have the same uri, you can set the priority attribute of the route to determine which route to match first, or add matching rules to distinguish different routes.
+
+1. Different routes have the same uri and set the `priority` attribute
+
+Create two routes with different `priority` values (the larger the value, the higher the priority).
Review comment:
We should mention the `priority` field is prior to the "other matching rules"
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,96 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same uri
+
+When different routes have the same uri, you can set the priority attribute of the route to determine which route to match first, or add matching rules to distinguish different routes.
Review comment:
"add other matching rules"
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607708875
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,11 +71,13 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Different routes have the same uri
+#### 4. Different routes have the same `uri`
-When different routes have the same uri, you can set the priority attribute of the route to determine which route to match first, or add matching rules to distinguish different routes.
+When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
-1. Different routes have the same uri and set the `priority` attribute
+Note: In matching rules, the `priority` field takes precedence over other rules. Therefore, we can set other matching rules only when the value of the `priority` field is the same.
Review comment:
Yes, this sentence seems superfluous.
Updated.
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -116,9 +118,9 @@ curl http://127.0.0.1:1980/hello
All requests only hit the route of port `1980`.
-2. Different routes have the same uri and set different matching conditions
+2. Different routes have the same `uri` and set `different matching conditions`
Review comment:
updated.
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607593175
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,96 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same uri
+
+When different routes have the same uri, you can set the priority attribute of the route to determine which route to match first, or add matching rules to distinguish different routes.
Review comment:
updated.
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607592966
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,96 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same uri
Review comment:
updated.
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r608360575
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,98 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same `uri`
+
+When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
Review comment:
Updated.
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r608360507
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -75,7 +75,7 @@ Here are the rules:
When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
-Note: In matching rules, the `priority` field takes precedence over other rules. Therefore, we can set other matching rules only when the value of the `priority` field is the same.
+Note: In matching rules, the `priority` field takes precedence over other rules.
Review comment:
Updated.
--
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] spacewander merged pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #3987:
URL: https://github.com/apache/apisix/pull/3987
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607592620
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,96 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same uri
+
+When different routes have the same uri, you can set the priority attribute of the route to determine which route to match first, or add matching rules to distinguish different routes.
+
+1. Different routes have the same uri and set the `priority` attribute
+
+Create two routes with different `priority` values (the larger the value, the higher the priority).
Review comment:
updated.
--
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] Firstsawyou commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r608360194
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,98 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same `uri`
+
+When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
+
+Note: In matching rules, the `priority` field takes precedence over other rules.
+
+1. Different routes have the same `uri` and set the `priority` field
+
+Create two routes with different `priority` values (the larger the value, the higher the priority).
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "priority": 3,
+ "uri": "/hello"
+}'
+```
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1981": 1
+ },
+ "type": "roundrobin"
+ },
+ "priority": 2,
+ "uri": "/hello"
+}'
+```
+
+Test:
+
+```shell
+curl http://127.0.0.1:1980/hello
+1980
+```
+
+All requests only hit the route of port `1980`.
+
+2. Different routes have the same `uri` and set different matching conditions
+
+Here is an example of setting host matching rules:
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "hosts": ["localhost.com"],
+ "uri": "/hello"
+}'
+```
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1981": 1
+ },
+ "type": "roundrobin"
+ },
+ "hosts": ["test.com"],
+ "uri": "/hello"
+}'
+```
+
+Test:
+
+```shell
+$ curl http://127.0.0.1:9080/hello -H 'host: localhost.com'
+1980
+```
+
+```shell
+$ curl http://127.0.0.1:9080/hello -H 'host: test.com'
+1981
+```
+
Review comment:
updated.
--
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] tokers commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r608274301
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,7 +71,98 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Parameter match
+#### 4. Different routes have the same `uri`
+
+When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
+
+Note: In matching rules, the `priority` field takes precedence over other rules.
+
+1. Different routes have the same `uri` and set the `priority` field
+
+Create two routes with different `priority` values (the larger the value, the higher the priority).
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "priority": 3,
+ "uri": "/hello"
+}'
+```
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1981": 1
+ },
+ "type": "roundrobin"
+ },
+ "priority": 2,
+ "uri": "/hello"
+}'
+```
+
+Test:
+
+```shell
+curl http://127.0.0.1:1980/hello
+1980
+```
+
+All requests only hit the route of port `1980`.
+
+2. Different routes have the same `uri` and set different matching conditions
+
+Here is an example of setting host matching rules:
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "hosts": ["localhost.com"],
+ "uri": "/hello"
+}'
+```
+
+```shell
+$ curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1981": 1
+ },
+ "type": "roundrobin"
+ },
+ "hosts": ["test.com"],
+ "uri": "/hello"
+}'
+```
+
+Test:
+
+```shell
+$ curl http://127.0.0.1:9080/hello -H 'host: localhost.com'
+1980
+```
+
+```shell
+$ curl http://127.0.0.1:9080/hello -H 'host: test.com'
+1981
+```
+
Review comment:
Add some concise descriptions?
--
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] spacewander commented on a change in pull request #3987: docs: add more example about how to use the router radixtree-uri
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3987:
URL: https://github.com/apache/apisix/pull/3987#discussion_r607637962
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -116,9 +118,9 @@ curl http://127.0.0.1:1980/hello
All requests only hit the route of port `1980`.
-2. Different routes have the same uri and set different matching conditions
+2. Different routes have the same `uri` and set `different matching conditions`
Review comment:
Why quote "different matching conditions"?
##########
File path: docs/en/latest/router-radixtree.md
##########
@@ -71,11 +71,13 @@ Here are the rules:
|/blog/foo/gloo | `/blog/foo/*` |
|/blog/bar | not match |
-#### 4. Different routes have the same uri
+#### 4. Different routes have the same `uri`
-When different routes have the same uri, you can set the priority attribute of the route to determine which route to match first, or add matching rules to distinguish different routes.
+When different routes have the same uri, you can set the priority field of the route to determine which route to match first, or add other matching rules to distinguish different routes.
-1. Different routes have the same uri and set the `priority` attribute
+Note: In matching rules, the `priority` field takes precedence over other rules. Therefore, we can set other matching rules only when the value of the `priority` field is the same.
Review comment:
> Therefore, we can set other matching rules only when the value of the `priority` field is the same.
Can't understand it. We can set `hosts` regardless of the value of `priority`.
--
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