You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "ro4i7 (via GitHub)" <gi...@apache.org> on 2023/03/14 22:39:42 UTC

[GitHub] [apisix] ro4i7 opened a new pull request, #9070: docs: Examples for Route Matching

ro4i7 opened a new pull request, #9070:
URL: https://github.com/apache/apisix/pull/9070

   ### Description
   added example to introduce the details of route match #5020; Issue description
   examples of this like:
   
   Host + URI
   Host + URI + Vars
   Host + URI + Vars + FilterFunctions;
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes #5020
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] shreemaan-abhishek closed pull request #9070: docs: Examples for Route Matching

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek closed pull request #9070: docs: Examples for Route Matching
URL: https://github.com/apache/apisix/pull/9070


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] ro4i7 commented on pull request #9070: docs: Examples for Route Matching

Posted by "ro4i7 (via GitHub)" <gi...@apache.org>.
ro4i7 commented on PR #9070:
URL: https://github.com/apache/apisix/pull/9070#issuecomment-1480589665

   @starsz can you please review this, and if possible please merge 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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] starsz commented on a diff in pull request #9070: docs: Examples for Route Matching

Posted by "starsz (via GitHub)" <gi...@apache.org>.
starsz commented on code in PR #9070:
URL: https://github.com/apache/apisix/pull/9070#discussion_r1150280856


##########
docs/en/latest/architecture-design/apisix.md:
##########
@@ -49,3 +49,70 @@ The diagram below shows how APISIX handles an incoming request and applies corre
 The chart below shows the order in which different types of Plugin are applied to a request:
 
 ![flow-plugin-internal](https://raw.githubusercontent.com/apache/apisix/master/docs/assets/images/flow-plugin-internal.png)
+
+## Examples of route matching
+
+1. Host + URI: This criterion matches requests based on the combination of the host and URI. For example, you could use this to match all requests to https://example.com/api.

Review Comment:
   > match all requests to https://example.com/api ?
   
   Or `https://example.com/foo/bar`?



##########
docs/en/latest/architecture-design/apisix.md:
##########
@@ -49,3 +49,70 @@ The diagram below shows how APISIX handles an incoming request and applies corre
 The chart below shows the order in which different types of Plugin are applied to a request:
 
 ![flow-plugin-internal](https://raw.githubusercontent.com/apache/apisix/master/docs/assets/images/flow-plugin-internal.png)
+
+## Examples of route matching
+
+1. Host + URI: This criterion matches requests based on the combination of the host and URI. For example, you could use this to match all requests to https://example.com/api.
+
+```
+{
+    "uri": "/foo/bar",
+    "host": "example.com",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "httpbin.org:80": 1
+        }
+    }
+}
+
+```
+
+2. Host + URI + Vars: This criterion matches requests based on the combination of the host, URI, and variables extracted from the URI using regular expressions. For example, you could use this to match all requests to https://example.com/api/users/123, where 123 is a variable extracted from the URI.

Review Comment:
   ```
   https://example.com/api/users/123,
   ``` ? 
   Are you sure ?



##########
docs/en/latest/architecture-design/apisix.md:
##########
@@ -49,3 +49,70 @@ The diagram below shows how APISIX handles an incoming request and applies corre
 The chart below shows the order in which different types of Plugin are applied to a request:
 
 ![flow-plugin-internal](https://raw.githubusercontent.com/apache/apisix/master/docs/assets/images/flow-plugin-internal.png)
+
+## Examples of route matching
+
+1. Host + URI: This criterion matches requests based on the combination of the host and URI. For example, you could use this to match all requests to https://example.com/api.
+
+```
+{
+    "uri": "/foo/bar",
+    "host": "example.com",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "httpbin.org:80": 1
+        }
+    }
+}
+
+```
+
+2. Host + URI + Vars: This criterion matches requests based on the combination of the host, URI, and variables extracted from the URI using regular expressions. For example, you could use this to match all requests to https://example.com/api/users/123, where 123 is a variable extracted from the URI.
+
+```
+{
+    "uri": "/foo/bar",
+    "host": "example.com",
+    "vars": {
+        "foo": "bar"
+    },
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "httpbin.org:80": 1
+        }
+    }
+}
+
+```
+
+3. Host + URI + Vars + FilterFunctions: This criterion matches requests based on the combination of the host, URI, variables extracted from the URI using regular expressions, and the output of a user-defined filter function. For example, you could use this to match all requests to https://example.com/api/users/123 where the variable 123 represents a user ID that is valid in your application's database.

Review Comment:
   Ditto.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] ro4i7 commented on a diff in pull request #9070: docs: Examples for Route Matching

Posted by "ro4i7 (via GitHub)" <gi...@apache.org>.
ro4i7 commented on code in PR #9070:
URL: https://github.com/apache/apisix/pull/9070#discussion_r1150411592


##########
docs/en/latest/architecture-design/apisix.md:
##########
@@ -49,3 +49,70 @@ The diagram below shows how APISIX handles an incoming request and applies corre
 The chart below shows the order in which different types of Plugin are applied to a request:
 
 ![flow-plugin-internal](https://raw.githubusercontent.com/apache/apisix/master/docs/assets/images/flow-plugin-internal.png)
+
+## Examples of route matching
+
+1. Host + URI: This criterion matches requests based on the combination of the host and URI. For example, you could use this to match all requests to https://example.com/api.

Review Comment:
   I have written here by taking some random examples in all three cases. Please tell me about this.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] Sn0rt commented on a diff in pull request #9070: docs: Examples for Route Matching

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on code in PR #9070:
URL: https://github.com/apache/apisix/pull/9070#discussion_r1309595303


##########
docs/en/latest/architecture-design/apisix.md:
##########
@@ -49,3 +49,70 @@ The diagram below shows how APISIX handles an incoming request and applies corre
 The chart below shows the order in which different types of Plugin are applied to a request:
 
 ![flow-plugin-internal](https://raw.githubusercontent.com/apache/apisix/master/docs/assets/images/flow-plugin-internal.png)
+
+## Examples of route matching
+
+1. Host + URI: This criterion matches requests based on the combination of the host and URI. For example, you could use this to match all requests to https://example.com/api.
+
+```
+{
+    "uri": "/foo/bar",
+    "host": "example.com",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "httpbin.org:80": 1
+        }
+    }
+}
+
+```
+
+2. Host + URI + Vars: This criterion matches requests based on the combination of the host, URI, and variables extracted from the URI using regular expressions. For example, you could use this to match all requests to https://example.com/api/users/123, where 123 is a variable extracted from the URI.
+
+```
+{
+    "uri": "/foo/bar",
+    "host": "example.com",
+    "vars": {
+        "foo": "bar"
+    },
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "httpbin.org:80": 1
+        }
+    }
+}
+
+```
+
+3. Host + URI + Vars + FilterFunctions: This criterion matches requests based on the combination of the host, URI, variables extracted from the URI using regular expressions, and the output of a user-defined filter function. For example, you could use this to match all requests to https://example.com/api/users/123 where the variable 123 represents a user ID that is valid in your application's database.

Review Comment:
   @ro4i7 PTAL



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] ro4i7 commented on pull request #9070: docs: Examples for Route Matching

Posted by "ro4i7 (via GitHub)" <gi...@apache.org>.
ro4i7 commented on PR #9070:
URL: https://github.com/apache/apisix/pull/9070#issuecomment-1476039839

   > In fact, I want to know the priority of those route match type.
   
   Priority of those route match in order is : 
   
   1. Host + URI + Vars + FilterFunctions: This criterion matches requests based on the combination of the host, URI, variables extracted from the URI using regular expressions, and the output of a user-defined filter function. This is the most specific and fine-grained type of route matching.
   
   2. Host + URI + Vars: This criterion matches requests based on the combination of the host, URI, and variables extracted from the URI using regular expressions. This is less specific than the previous type but still allows for some level of variable-based matching.
   
   3. Host + URI: This criterion matches requests based on the combination of the host and URI. This is the least specific type of route matching and will match any requests with the specified host and URI.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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