Firstsawyou commented on issue #4090:
URL: https://github.com/apache/apisix/issues/4090#issuecomment-823709437


   You can try the traffic-split plug-in. Here is an example of configuration:
   
   ```shell
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/hello",
       "plugins": {
           "traffic-split": {
               "rules": [
                   {
                       "match": [
                           {
                               "vars": [
                                   ["http_id","==","1"]
                               ]
                           }
                       ],
                       "weighted_upstreams": [
                           {
                               "upstream": {
                                   "name": "upstream_A",
                                   "type": "roundrobin",
                                   "nodes": {
                                       "127.0.0.1:1981":1
                                   }
                               },
                               "weight": 3
                           }
                       ]
                   },
                   {
                       "match": [
                           {
                               "vars": [
                                   ["http_id","==","2"]
                               ]
                           }
                       ],
                       "weighted_upstreams": [
                           {
                               "upstream": {
                                   "name": "upstream_B",
                                   "type": "roundrobin",
                                   "nodes": {
                                       "127.0.0.1:1982":1
                                   }
                               },
                               "weight": 3
                           }
                       ]
                   }
               ]
           }
       },
       "upstream": {
               "type": "roundrobin",
               "nodes": {
                   "127.0.0.1:1980": 1
               }
       }
   }'
   ```
   
   However, it may not take effect in APISIX 2.5. You can try it in versions 
before 2.5.


-- 
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:
us...@infra.apache.org


Reply via email to