You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "githubxubin (via GitHub)" <gi...@apache.org> on 2023/08/18 01:58:27 UTC
[GitHub] [apisix] githubxubin opened a new issue, #10052: traffic-split expression help
githubxubin opened a new issue, #10052:
URL: https://github.com/apache/apisix/issues/10052
### Description
When I used the traffic-split plugin, my matching criteria didn't work
my step:
step 1:
set the route :
my route config is :
```
{
"id": "474448073225929411",
"create_time": 1692322688,
"update_time": 1692324034,
"uris": [
"/http/*",
"/fuwu/*"
],
"name": "测试https12",
"priority": 1,
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS"
],
"hosts": [
"cestest.com.cn",
"yangcong.com.cn"
],
"plugins": {
"proxy-rewrite": {
"headers": {
"ceshi": "aaa",
"ceshi1": "bbb",
"ceshi3": "ccc"
},
"method": "GET",
"scheme": "http"
},
"traffic-split": {
"disable": false,
"rules": [
{
"match": [
{
"vars": [
[
"request_uri",
"has",
"/fuwu/1k.txt"
]
]
}
],
"weighted_upstreams": [
{
"upstream_id": "474448922102727363",
"weight": 1
},
{
"upstream_id": "474448948208075459",
"weight": 1
},
{
"weight": 1
}
]
}
]
}
},
"upstream": {
"nodes": [
{
"host": "10.4.16.14",
"port": 9080,
"weight": 1
}
],
"retries": 3,
"timeout": {
"connect": 30,
"send": 30,
"read": 60
},
"type": "roundrobin",
"scheme": "http",
"pass_host": "pass",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
},
"retry_timeout": 5000
},
"status": 1
}
```
step 2 :
access the apisix route:
curl http://yangcong.com.cn:9080/fuwu/1k.txt
always to host:10.4.16.14
However, my traffic does not match the upstream information in traffic-split and is forwarded to the route itself. Is there a problem with my expression
```
...
"match": [
{
"vars": [
[
"request_uri",
"has",
"/fuwu/1k.txt"
]
]
}
],
...
```
### Environment
- APISIX version (run `apisix version`):2.15
- Operating system (run `uname -a`):
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`):
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] shreemaan-abhishek commented on issue #10052: traffic-split expression help
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10052:
URL: https://github.com/apache/apisix/issues/10052#issuecomment-1683644433
Please close the issue if you have no more questions.
--
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 commented on issue #10052: traffic-split expression help
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10052:
URL: https://github.com/apache/apisix/issues/10052#issuecomment-1683643761
https://apisix.apache.org/docs/apisix/next/plugins/traffic-split/#custom-release
--
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 commented on issue #10052: traffic-split expression help
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10052:
URL: https://github.com/apache/apisix/issues/10052#issuecomment-1683343444
```
...
"match": [
{
"vars": [
[
"request_uri",
"has",
"/fuwu/1k.txt"
]
]
}
],
...
```
`has` evaluates if a table (on the left-hand side)`has` the item mentioned on the operator's right-hand side.
You can use `~~` expresion to match regex instead. https://github.com/api7/lua-resty-expr/blob/main/README.md#comparison-operators
--
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] githubxubin commented on issue #10052: traffic-split expression help
Posted by "githubxubin (via GitHub)" <gi...@apache.org>.
githubxubin commented on issue #10052:
URL: https://github.com/apache/apisix/issues/10052#issuecomment-1683366761
>
> ```
> ...
> "match": [
> {
> "vars": [
> [
> "request_uri",
> "has",
> "/fuwu/1k.txt"
> ]
> ]
> }
> ],
> ...
> ```
>
> `has` evaluates if a table (on the left-hand side)`has` the item mentioned on the operator's right-hand side.
>
> You can use `~~` expresion to match regex instead. https://github.com/api7/lua-resty-expr/blob/main/README.md#comparison-operators
> ```
> ...
> "match": [
> {
> "vars": [
> [
> "request_uri",
> "has",
> "/fuwu/1k.txt"
> ]
> ]
> }
> ],
> ...
> ```
>
> `has` evaluates if a table (on the left-hand side)`has` the item mentioned on the operator's right-hand side.
>
> You can use `~~` expresion to match regex instead. https://github.com/api7/lua-resty-expr/blob/main/README.md#comparison-operators
Ok, can you give me a case where **has** is used?
--
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] githubxubin closed issue #10052: traffic-split expression help
Posted by "githubxubin (via GitHub)" <gi...@apache.org>.
githubxubin closed issue #10052: traffic-split expression help
URL: https://github.com/apache/apisix/issues/10052
--
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 commented on issue #10052: traffic-split expression help
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10052:
URL: https://github.com/apache/apisix/issues/10052#issuecomment-1684153754
https://github.com/api7/lua-resty-expr/blob/feaed584b96dcd6d100bef9d98c3726821465a5a/t/v1/sanity.t#L296C1-L315C6
--
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