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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to