aiyiyi121 opened a new issue #3851:
URL: https://github.com/apache/apisix/issues/3851


   ### Issue description
   目的:想要根据分流规则,比如user-name=test,让流量跑到k8s集群中不同的ingress。
   实现方法:使用nginx做为ingress controller,提供两个ingress 
controller的地址对外访问,通过改变Host,让流量跑到相应的ingress。详细配置见下面
   
遇到问题:traffic-split里面的upstream通过upstream_host字段不能正确改变Host字段,访问时报错404,不把upstream配在traffic-split里时没问题
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.4
   * OS (cmd: `uname -a`): Ubuntu 16.04.2 LTS
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): 
openresty/1.19.3.1
   * etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): 
3.4.13
   * apisix-dashboard version, if have: 2.4
   
   ### 路由配置
   curl http://127.0.0.1:9080/apisix/admin/routes/10 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/route10",
       "plugins": {
           "traffic-split": {
               "rules": [
                   {
                       "match": [
                           {
                               "vars": [
                                   ["http_username", "==", "test"]
                               ]
                           }
                       ],
                       "weighted_upstreams": [
                           {
                               "upstream": {
                                       "type": "roundrobin",
                                       "pass_host": "rewrite",
                                       "upstream_host": 
"echo-headers.pro.test-k8s.qslocal.com",
                                       "nodes": {
                                           "10.255.1.107:80":1,
                                           "10.255.1.108:80":1
                                       }
                               }
                           }
                       ]
                   }
               ]
           }
       },
       "upstream": {
               "type": "roundrobin",
               "pass_host": "rewrite",
               "upstream_host": "echo-headers.pro.test-k8s.qslocal.com",
               "nodes": {
                   "10.255.1.107:80":1,
                   "10.255.1.108:80":1
               }
       }
   }'
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   traffic-split插件中upstream_host改变没生效,流量到不了相应host的ingress,报错404
   


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


Reply via email to