houshunwei opened a new issue #1646:
URL: https://github.com/apache/incubator-apisix/issues/1646


   ### Issue description
   For grpc-proxy:
   when I add  `limit-req` into `service`, it works fine.
   but when I add `limit-req` into `consumer`, it doesn't work. 
   
   For httpbin proxy(normal http 1.1 , not grpc proxy.):
   when I add `limit-req` into `consumer`,  it works fine.
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 1.3
   * OS: centos, docker
   
   ### Minimal test code / Steps to reproduce the issue
   1. add consumer
   ```
   curl http://127.0.0.1:9080/apisix/admin/consumers/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "username": "jwt1",
       "plugins": {
           "jwt-auth": {
               "key": "ak",
               "secret": "sk"
           },
           "limit-req": {
               "rate": 1,
               "burst": 0,
               "rejected_code": 429,
               "key": "remote_addr"
           }
       }
   }'
   ```
   
   2. add grpc route
   
   ```
   //172.21.144.41:50051 is grpc server. you may need to change it to 
127.0.0.1:50051
   curl http://127.0.0.1:9080/apisix/admin/upstreams/8 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "type": "roundrobin",
           "nodes": {
               "172.21.144.41:50051": 1  
           }
   }'
   ```
   ```
   curl http://127.0.0.1:9080/apisix/admin/services/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "upstream_id": 8
   }'
   ```
   
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "methods": ["POST", "GET"],
       "uri": "/helloworld.Greeter/SayHello",
       "service_protocol": "grpc",
       "service_id": 1,
       "plugins": {
           "jwt-auth": {}
       }
   }'
   ```
   3. fetch jwt token
   ```
   curl http://127.0.0.1:9080/apisix/plugin/jwt/sign\?key\=ak
   ```
   4. request service
   ```
   grpcurl -v -insecure -import-path ./proto/  -proto helloworld.proto  \
       -d '{"name":"apisix"}' -H 'Authorization: 
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJhayIsImV4cCI6MTU5MTI2NjExNX0.Ok07taBf2KglnuqHtMWwxqNJ6CBo451uJmsMHkFblGc'
 127.0.0.1:9443 helloworld.Greeter.SayHello
   ```
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   limit-req is not work
   
   
   ### What's the expected result?
   limit-req should work just like normal http request.
   


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