navendu-pottekkat commented on PR #6929:
URL: https://github.com/apache/apisix/pull/6929#issuecomment-1110553151

   @Baoyuantop @hf400159 I fixed the second Route creation step after 
abstracting to Upstream. It is working for me as expected. I'm using an M1 Mac.
   
   ```shell
   ➜  example git:(master) ✗ curl --location --request GET 
"http://httpbin.org/get?foo1=bar1&foo2=bar2";
   {
     "args": {
       "foo1": "bar1", 
       "foo2": "bar2"
     }, 
     "headers": {
       "Accept": "*/*", 
       "Host": "httpbin.org", 
       "User-Agent": "curl/7.79.1", 
       "X-Amzn-Trace-Id": "Root=1-6268d0d6-59f80a1b02e8b74f2a5f6511"
     }, 
     "origin": "117.213.46.176", 
     "url": "http://httpbin.org/get?foo1=bar1&foo2=bar2";
   }
   ➜  example git:(master) ✗ docker-compose -p docker-apisix -f 
docker-compose-arm64.yml up -d
   Creating network "docker-apisix_apisix" with driver "bridge"
   Creating docker-apisix_etcd_1             ... done
   Creating docker-apisix_web1_1             ... done
   Creating docker-apisix_web2_1             ... done
   Creating docker-apisix_apisix-dashboard_1 ... done
   Creating docker-apisix_apisix_1           ... done
   ➜  example git:(master) ✗ curl 
"http://127.0.0.1:9080/apisix/admin/services/"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1'
   
{"action":"get","node":{"key":"\/apisix\/services","nodes":[],"dir":true},"count":0}
   ➜  example git:(master) ✗ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; 
-H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "methods": ["GET"],
     "host": "example.com",
     "uri": "/anything/*",
     "upstream": {
       "type": "roundrobin",
       "nodes": {
         "httpbin.org:80": 1
       }
     }
   }'
   
{"node":{"key":"\/apisix\/routes\/1","value":{"methods":["GET"],"uri":"\/anything\/*","host":"example.com","upstream":{"scheme":"http","pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars"},"priority":0,"update_time":1651036453,"create_time":1651036453,"id":"1","status":1}},"action":"set"}
   ➜  example git:(master) ✗ curl -i -X GET 
"http://127.0.0.1:9080/anything/foo?arg=10"; -H "Host: example.com"
   HTTP/1.1 200 OK
   Content-Type: application/json
   Content-Length: 425
   Connection: keep-alive
   Date: Wed, 27 Apr 2022 05:14:19 GMT
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Server: APISIX/2.13.1
   
   {
     "args": {
       "arg": "10"
     }, 
     "data": "", 
     "files": {}, 
     "form": {}, 
     "headers": {
       "Accept": "*/*", 
       "Host": "example.com", 
       "User-Agent": "curl/7.79.1", 
       "X-Amzn-Trace-Id": "Root=1-6268d12b-695b7ba534d740fa278e6013", 
       "X-Forwarded-Host": "example.com"
     }, 
     "json": null, 
     "method": "GET", 
     "origin": "172.21.0.1, 117.213.46.176", 
     "url": "http://example.com/anything/foo?arg=10";
   }
   ➜  example git:(master) ✗ curl 
"http://127.0.0.1:9080/apisix/admin/upstreams/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "type": "roundrobin",
     "nodes": {
       "httpbin.org:80": 1
     }
   }'
   
{"node":{"key":"\/apisix\/upstreams\/1","value":{"scheme":"http","pass_host":"pass","nodes":{"httpbin.org:80":1},"update_time":1651036477,"type":"roundrobin","id":"1","create_time":1651036477,"hash_on":"vars"}},"action":"set"}
   ➜  example git:(master) ✗ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; 
-H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {
     "methods": ["GET"],
     "host": "example.com",
     "uri": "/anything/*",
     "upstream": {
       "type": "roundrobin",
       "nodes": {
         "httpbin.org:80": 1
       }
     }
   }'
   
{"action":"set","node":{"key":"\/apisix\/routes\/1","value":{"methods":["GET"],"uri":"\/anything\/*","host":"example.com","upstream":{"scheme":"http","pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars"},"priority":0,"update_time":1651036490,"create_time":1651036453,"id":"1","status":1}}}
   ➜  example git:(master) ✗ curl -i -X GET 
"http://127.0.0.1:9080/anything/foo?arg=10"; -H "Host: example.com"
   HTTP/1.1 200 OK
   Content-Type: application/json
   Content-Length: 425
   Connection: keep-alive
   Date: Wed, 27 Apr 2022 05:15:08 GMT
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Server: APISIX/2.13.1
   
   {
     "args": {
       "arg": "10"
     }, 
     "data": "", 
     "files": {}, 
     "form": {}, 
     "headers": {
       "Accept": "*/*", 
       "Host": "example.com", 
       "User-Agent": "curl/7.79.1", 
       "X-Amzn-Trace-Id": "Root=1-6268d15c-365a35046232f6d33facdff3", 
       "X-Forwarded-Host": "example.com"
     }, 
     "json": null, 
     "method": "GET", 
     "origin": "172.21.0.1, 117.213.46.176", 
     "url": "http://example.com/anything/foo?arg=10";
   }
   ```


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