You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/06/03 13:40:12 UTC

[GitHub] [incubator-apisix] houshunwei opened a new issue #1646: bug: limit-req in consumer is not work for grpc-proxy

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



[GitHub] [incubator-apisix] nic-chen edited a comment on issue #1646: bug: limit-req in consumer is not work for grpc-proxy

Posted by GitBox <gi...@apache.org>.
nic-chen edited a comment on issue #1646:
URL: https://github.com/apache/incubator-apisix/issues/1646#issuecomment-638546831


   yes, it can't recognize consumer in `grpc-proxy` yet. 
   pr is welcome, or I will handle it later.


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



[GitHub] [incubator-apisix] nic-chen edited a comment on issue #1646: bug: limit-req in consumer is not work for grpc-proxy

Posted by GitBox <gi...@apache.org>.
nic-chen edited a comment on issue #1646:
URL: https://github.com/apache/incubator-apisix/issues/1646#issuecomment-640189842


   > i am a fresh man of lua and openresty.
   > can you give me some hint(For example, which file should be mainly changed)? So i can try to support it.
   
   I'm sorry to reply to you so late. 
   It should be the problem here. The consumer plugin is not run:
   
   http:
   https://github.com/apache/incubator-apisix/blob/master/apisix/init.lua#L377
   grpc:
   https://github.com/apache/incubator-apisix/blob/master/apisix/init.lua#L443
   
   According to your issues description, I feel that it should be easy for you, come on, haha
   


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



[GitHub] [incubator-apisix] houshunwei commented on issue #1646: bug: limit-req in consumer is not work for grpc-proxy

Posted by GitBox <gi...@apache.org>.
houshunwei commented on issue #1646:
URL: https://github.com/apache/incubator-apisix/issues/1646#issuecomment-638561985


   > yes, it can't recognize consumer in `grpc-proxy` yet.
   > pr is welcome, or I will handle it later.
   
   i am a fresh man of lua and openresty.
   can you give me some hint(For example, which file should be mainly changed)? So i can try to support it.


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



[GitHub] [incubator-apisix] nic-chen commented on issue #1646: bug: limit-req in consumer is not work for grpc-proxy

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #1646:
URL: https://github.com/apache/incubator-apisix/issues/1646#issuecomment-640189842


   > i am a fresh man of lua and openresty.
   > can you give me some hint(For example, which file should be mainly changed)? So i can try to support it.
   
   I'm sorry to reply to you so late. 
   It should be the problem here. The consumer plugin is not run:
   
   https://github.com/apache/incubator-apisix/blob/master/apisix/init.lua#L377
   
   According to your issues description, I feel that it should be easy for you, come on, haha
   


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



[GitHub] [incubator-apisix] nic-chen commented on issue #1646: bug: limit-req in consumer is not work for grpc-proxy

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #1646:
URL: https://github.com/apache/incubator-apisix/issues/1646#issuecomment-638546831


   yes, it can't recognize consumer yet. 
   pr is welcome, or I will handle it later.


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