-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help request: how to proxy http+pb #11260
Comments
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 |
I'm not aware if APISIX can do this. @shreemaan-abhishek thoughts? |
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. |
I meant to ask, does the upstream return JSON even when not using APISIX? |
upstream return pb, protocol is grpc |
@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. |
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://xxxxxxxxxx",
"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
):3.6.0uname -a
): Linux localhost.localdomain 4.18.0-513.9.1.el8_9.x86_64 change: added doc of how to load plugin. #1 SMP Wed Nov 29 18:55:19 UTC 2023 x86_64 x86_64 x86_64 GNU/Linuxopenresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):The text was updated successfully, but these errors were encountered: