Firstsawyou edited a comment on issue #3271:
URL: https://github.com/apache/apisix/issues/3271#issuecomment-759443252


   Hi,@htwdjqr  
   My test is normal,You need to provide more information such as etcd 
configuration to help me troubleshoot your problem.
   
   here are my test steps:
   
   1. Create a route:
   
   ```shell
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uris": ["/get"],
       "plugins": {
           "traffic-split": {
               "rules": [{
               "match": [{
                   "vars": [
                   [
                       "http_release",
                       "==",
                       "new_release"
                   ]
                   ]
               }],
               "weighted_upstreams": [{
                   "upstream": {
                   "name": "upstream_A",
                   "nodes": {
                       "httpbin.org:80": 10
                   },
                   "type": "roundrobin"
                   }
               }]
               }]
           }
       }
   }'
   ```
   
   2. Check the configuration of etcd:
   
   ```shell
   $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X GET
   
{"count":"1","action":"get","node":{"key":"\/apisix\/routes\/1","value":{"priority":0,"id":"1","update_time":1610542902,"plugins":{"traffic-split":{"rules":[{"match":[{"vars":[["http_release","==","new_release"]]}],"weighted_upstreams":[{"upstream":{"nodes":{"httpbin.org:80":10},"type":"roundrobin","hash_on":"vars","pass_host":"pass","name":"upstream_A"},"weight":1}]}]}},"status":1,"uris":["\/get"],"create_time":1610288363}}}
   ```
   
   3. Initiate request access routing(match successfully):
   
   ```shell
   $ curl http://127.0.0.1:9080/get -H 'release: new_release' -i
   HTTP/1.1 200 OK
   Content-Type: application/json
   Content-Length: 330
   Connection: keep-alive
   Date: Wed, 13 Jan 2021 13:09:13 GMT
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Server: APISIX/2.2
   
   {
     "args": {}, 
     "headers": {
       "Accept": "*/*", 
       "Host": "127.0.0.1", 
       "Release": "new_release", 
       "User-Agent": "curl/7.29.0", 
       "X-Amzn-Trace-Id": "Root=1-5ffef0f9-1832d58f04dd9f5359b16fcd", 
       "X-Forwarded-Host": "127.0.0.1"
     }, 
     "origin": "127.0.0.1, 121.41.116.83", 
     "url": "http://127.0.0.1/get";
   }
   ```
   
   4. Initiate request access routing(match failed):
   
   ```shell
   $ curl http://127.0.0.1:9080/get -H 'release: old_release' -i
   HTTP/1.1 500 Internal Server Error
   Date: Wed, 13 Jan 2021 13:14:15 GMT
   Content-Type: text/html; charset=utf-8
   Content-Length: 174
   Connection: close
   Server: APISIX/2.2
   
   <html>
   <head><title>500 Internal Server Error</title></head>
   <body>
   <center><h1>500 Internal Server Error</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   ```
   


----------------------------------------------------------------
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