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/07/13 09:15:48 UTC

[GitHub] [incubator-apisix] houshunwei commented on issue #1833: request help: how to proxy grpc to grpcs.

houshunwei commented on issue #1833:
URL: https://github.com/apache/incubator-apisix/issues/1833#issuecomment-657432792


   I have resolve this problem:
   
   First Try: extend proxy-rewrite(add grpc and grpcs scheme) and change apisix bin file:
   ```
   location @grpc_pass {
               set $upstream_scheme             'grpc';
               access_by_lua_block {
                   apisix.grpc_access_phase()
               }
   
               grpc_set_header   Content-Type application/grpc;
               grpc_socket_keepalive on;
               grpc_pass         $upstream_scheme://apisix_backend;
   ...
   ```
   Problem: `grpc_pass` is different form `proxy_pass`, it cannot accept variable( which you defined by `set`).
   Result: `Failed`.
   
   Second Try:add other block in apisix bin file. and change jugement in init.lua
   ```
   location @grpc_pass_ssl {
               access_by_lua_block {
                   apisix.grpc_access_phase()
               }
   
               grpc_set_header   Content-Type application/grpc;
               grpc_socket_keepalive on;
               grpc_pass         grpcs://apisix_backend;
   ...
   ```
   
   Result: It works!
   
   I will close this issue now.


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