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 2022/02/10 12:04:48 UTC

[GitHub] [apisix] crazyMonkey1995 opened a new issue #6288: bug: traffic-split plugin do not match if the first matcher failed

crazyMonkey1995 opened a new issue #6288:
URL: https://github.com/apache/apisix/issues/6288


   ### Issue description
   
   According to the plugin's documentation: https://apisix.apache.org/docs/apisix/plugins/traffic-split/
   I configured two rules:
   ```
   "traffic-split": {
         "rules": [
           {
             "match": [
               {
                 "vars": [
                   [
                     "http_x-my-header",
                     "==",
                     "1"
                   ]
                 ]
               }
             ],
             "weighted_upstreams": [
               {
                 "upstream_id": "demo-1",
                 "weight": 100
               }
             ]
           },
           {
             "weighted_upstreams": [
               {
                 "upstream_id": "demo-2",
                 "weight": 50
               },
               {
                 "weight": 50
               }
             ]
           }
         ]
       }
   ```
   When the first rule does not match, the second rule also fails, I looked at the relevant code, the problem should be here:
   ![image](https://user-images.githubusercontent.com/21658981/153405333-2743522f-c86c-47a2-8613-e0d7fab27824.png)
   
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.12.0
   
   
   ### Steps to reproduce
   
   1、create arbitrary routes
   2、add traffic-split plugin for it config like above
   3、access the relevant route, intentionally not matching the first rule
   
   ### Actual result
   
   The second rule is ignored
   
   ### Error log
   
   2022/02/10 19:46:47 [info] 137#137: *898767 [lua] traffic-split.lua:264: phase_func(): match_passed: false, client: 127.0.0.1, server: _, request: "GET /demo/ip HTTP/1.1", host: "test.com"
   
   ### Expected result
   
   The second rule should be matched


-- 
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] spacewander closed issue #6288: bug: traffic-split plugin do not match if the first matcher failed

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #6288:
URL: https://github.com/apache/apisix/issues/6288


   


-- 
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] crazyMonkey1995 commented on issue #6288: bug: traffic-split plugin do not match if the first matcher failed

Posted by GitBox <gi...@apache.org>.
crazyMonkey1995 commented on issue #6288:
URL: https://github.com/apache/apisix/issues/6288#issuecomment-1034845184


   Add "match_passed=true" before line 241 should fix 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