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 2022/06/30 11:30:30 UTC

[GitHub] [apisix] caozhi6655 opened a new issue, #7363: help request: real-ip plugin can't support for grpc proxy

caozhi6655 opened a new issue, #7363:
URL: https://github.com/apache/apisix/issues/7363

   ### Description
   
   I use apisix for the grpc proxy,and i need to set custom header like X-Real-IP for the grpc header like:
   `grpc_set_header X-Real-IP ($remote_addr | OtherParam)`,but I found it can't support for this。
   And in the ngx_tpl.lua there is no `proxy_set_header   X-Real-IP         $remote_addr;`
   
   I think apisix now give the grpc proxy support very poor,and I think apisix can't give a config for grpc like:
   `
   apisix:
       grpc: xxxx
   `
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] caozhi6655 commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
caozhi6655 commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1174518062

   > Consider solved. Feel free to reopen it if needed.
   But the real-ip plugin still can't support for grpc。It can solve the problem in another way,and i think designing a unified way to solve more protocols like grpc、http2 and so on is a better way like @tokens said。I hope it can be implement quickly。
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
soulbird commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1171841201

   Sounds good!And it seems that there needs to be an FFI implementation of `grpc_set_header` first.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1172135297

   > > Since grpc is based on HTTP2, could we solve it with `ngx.req.set_header`?
   > > year,lua can do anything,but i think it becomes a dynamic configuration same good and it is what apisix does。And as a common developer,he needn't to modify the source code。
   
   What we talked is the default behaviors. Of course we need to expose the chance for users via the proxy-rewrite plugin.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] bzp2010 commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1171820819

   @tokers 


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1171819625

   APISIX passes the client IP through `X-Forwarded-For` header, does it solve your problem?


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] caozhi6655 commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
caozhi6655 commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1173254929

   > Yes I tested it, `ngx.req_set_header` is ok. So we can implement X-Real-IP settings through the` proxy-rewrite` plugin. Like:
   > 
   > ```json
   > {
   >     "methods": ["POST", "GET"],
   >     "uri": "/helloworld.Greeter/Echo",
   >     "plugins": {
   >         "proxy-rewrite": {
   >             "headers": {
   >                 "X-Real-IP": "$remote_addr"
   >             }
   >         }
   >     },
   >     "upstream": {
   >         "scheme": "grpc",
   >         "type": "roundrobin",
   >         "nodes": {
   >             "127.0.0.1:50051": 1
   >         }
   >     }
   > }
   > ```
   > 
   > However, as @tokers said, maybe we should move some [header setting related logic](https://github.com/apache/apisix/blob/master/apisix/cli/ngx_tpl.lua#L702-L725) to lua to get better compatibility.
   
   I understand,thanks very much!


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
soulbird commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1173023113

   Yes I tested it, `ngx.req_set_header` is ok. So we can implement X-Real-IP settings through the` proxy-rewrite` plugin. Like:
   ```json
   {
       "methods": ["POST", "GET"],
       "uri": "/helloworld.Greeter/Echo",
       "plugins": {
           "proxy-rewrite": {
               "headers": {
                   "X-Real-IP": "$remote_addr"
               }
           }
       },
       "upstream": {
           "scheme": "grpc",
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:50051": 1
           }
       }
   }
   ```
   However, as @tokers  said, maybe we [should move some header setting related logic(https://github.com/apache/apisix/blob/master/apisix/cli/ngx_tpl.lua#L702-L725) to lua to get better compatibility.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] caozhi6655 commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
caozhi6655 commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1172109107

   > Since grpc is based on HTTP2, could we solve it with `ngx.req.set_header`?
   year,lua can do anything,but i think it becomes a dynamic configuration same good and it is what apisix does。
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1173386055

   Consider solved. Feel free to reopen it if needed.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1171822777

   @bzp2010 That's a moment to change the way we set X-Forwarded-* headers, I think we need an unified way to do that. No matter which protocols the users use.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander commented on issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #7363:
URL: https://github.com/apache/apisix/issues/7363#issuecomment-1171956193

   Since grpc is based on HTTP2, could we solve it with `ngx.req.set_header`?


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander closed issue #7363: help request: real-ip plugin can't support for grpc proxy

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #7363: help request: real-ip plugin can't support for grpc proxy
URL: https://github.com/apache/apisix/issues/7363


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org