You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "snowleopard331 (via GitHub)" <gi...@apache.org> on 2024/05/16 10:14:34 UTC

[I] help request: 如何正确配置http+pb的请求方式 [apisix]

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

   ### Description
   
   我想使用http+pb的方式进行请求,但是打开grpc-transcode插件后,无论json/pb都可以请求到,但是返回的始终是json,我的需求是返回pb。请求头中的accept也设置过,但是都没用,以下是我的路由配置:
   
   {
     "uri": "/HelloWorld",
     "name": "HelloWorld",
     "desc": "HelloWorld接口,测试连通性",
     "methods": [
       "POST"
     ],
     "plugins": {
       "elasticsearch-logger": {
         "batch_max_size": 1000,
         "buffer_duration": 60,
         "endpoint_addr": "http://192.168.27.8:9200",
         "field": {
           "index": "apisixlog"
         },
         "inactive_timeout": 5,
         "max_retry_count": 0,
         "name": "elasticsearch-logger",
         "retry_delay": 1,
         "ssl_verify": true,
         "timeout": 10
       },
       "grpc-transcode": {
         "_meta": {
           "disable": false
         },
         "deadline": 0,
         "method": "HelloWorld",
         "pb_option": [
           "enum_as_name",
           "int64_as_number",
           "no_default_values",
           "disable_hooks"
         ],
         "proto_id": "xxxxxxxxxxxx",
         "service": "xxxxxxxxxx",
         "show_status_in_body": false
       },
       "jwt-auth": {
         "_meta": {
           "disable": true
         },
         "cookie": "jwt",
         "header": "authorization",
         "hide_credentials": false,
         "query": "jwt"
       }
     },
     "upstream": {
       "retries": 3,
       "timeout": {
         "connect": 6,
         "send": 6,
         "read": 6
       },
       "type": "chash",
       "hash_on": "header",
       "key": "USERID",
       "scheme": "grpc",
       "discovery_type": "nacos",
       "discovery_args": {
         "group_name": "xxxxxxxxx",
         "namespace_id": "xxxxxxxxxxxxx"
       },
       "pass_host": "pass",
       "service_name": "providers:kiwi.domainServer.example::",
       "keepalive_pool": {
         "idle_timeout": 60,
         "requests": 1000,
         "size": 320
       },
       "retry_timeout": 1
     },
     "status": 1
   }
   
   
   
   ### Environment
   
   - APISIX version (run `apisix version`):3.6.0
   - Operating system (run `uname -a`): Linux localhost.localdomain 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Wed Nov 29 18:55:19 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
   - 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


Re: [I] help request: how to proxy http+pb [apisix]

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2143719156

   no there is no such feature.


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


Re: [I] help request: how to proxy http+pb [apisix]

Posted by "snowleopard331 (via GitHub)" <gi...@apache.org>.
snowleopard331 commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2146403425

   > no there is no such feature. do you mean to say that upstream returns PB but APISIX modifies it to JSON?
   
   No.   All PB.  No JSON.  Do you know how to config APISIX route?  Send PB and receive PB.  Thank you. 


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


Re: [I] help request: 如何正确配置http+pb的请求方式 [apisix]

Posted by "snowleopard331 (via GitHub)" <gi...@apache.org>.
snowleopard331 commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2126065029

   > `grpc-transcode` is for transcoding between regular HTTP requests and gRPC, so it is expected that the upstream response is returned in JSON.
   > 
   > It sounds like you are not looking for any transcoding but to have APISIX proxy for your request to gRPC upstream service, is that correct?
   
   At present, I am using APISIX to proxy my upstreams, and the client uses JSON as the HTTP body. Currently, grpc-transcode is enabled, so the client's input and output are both in JSON format. Now the client wants to use protobuf as the input and output, but I don't know how to configure it. I have tried some solutions, but none have been successful; using HTTP+PB requests, the upstream can receive and process them, but APISIX always returns JSON to the client. What I want is a route configuration that can return protobuf. Thanks


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


Re: [I] help request: how to proxy http+pb [apisix]

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2152635850

   @snowleopard331, can you prepare a github gist/repo with a self contained example to reproduce this issue? I will take a look at this when I am free.


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


Re: [I] help request: how to proxy http+pb [apisix]

Posted by "snowleopard331 (via GitHub)" <gi...@apache.org>.
snowleopard331 commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2149231513

   > > No. All PB. No JSON.
   > 
   > I meant to ask, does the upstream return JSON even when not using APISIX?
   
   upstream return pb, protocol is grpc


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


Re: [I] help request: 如何正确配置http+pb的请求方式 [apisix]

Posted by "kayx23 (via GitHub)" <gi...@apache.org>.
kayx23 commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2119702572

   `grpc-transcode` is for transcoding between regular HTTP requests and gRPC, so it is expected that the upstream response is returned in JSON.
   
   It sounds like you are not looking for any transcoding but to have APISIX proxy for your request to gRPC upstream service, is that correct? 


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


Re: [I] help request: how to proxy http+pb [apisix]

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2146617696

   > No. All PB. No JSON.
   
   I meant to ask, does the upstream return JSON even when not using APISIX?


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


Re: [I] help request: how to proxy http+pb [apisix]

Posted by "kayx23 (via GitHub)" <gi...@apache.org>.
kayx23 commented on issue #11260:
URL: https://github.com/apache/apisix/issues/11260#issuecomment-2126468504

   > APISIX always returns JSON to the client. What I want is a route configuration that can return protobuf.
   
   I'm not aware if APISIX can do this. @shreemaan-abhishek thoughts?


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