Google cloud platform 谷歌端点&x2B;grpc网络
如esp proxy for Google endpoints()的变更日志所示,已经为其添加了对grpc web的支持 然而,我无法让它工作。我使用以下cors配置部署了espGoogle cloud platform 谷歌端点&x2B;grpc网络,google-cloud-platform,google-cloud-endpoints,grpc,grpc-web,Google Cloud Platform,Google Cloud Endpoints,Grpc,Grpc Web,如esp proxy for Google endpoints()的变更日志所示,已经为其添加了对grpc web的支持 然而,我无法让它工作。我使用以下cors配置部署了esp # Note: The following lines are included in a server block, so we cannot use all Nginx constructs here. set $cors_expose_headers ""; set $cors_max_age ""; if (
# Note: The following lines are included in a server block, so we cannot use all Nginx constructs here.
set $cors_expose_headers "";
set $cors_max_age "";
if ($request_method = 'OPTIONS') {
set $cors_max_age 1728000;
return 204;
}
if ($request_method = 'POST') {
set $cors_expose_headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout';
}
if ($request_method = 'GET') {
set $cors_expose_headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout';
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout';
add_header 'Access-Control-Expose-Headers' $cors_expose_headers;
add_header 'Access-Control-Max-Age' $cors_max_age;
然后配置了一个GRPC Google端点
当我尝试向该端点发送grpc web请求时,我可以看到选项
请求通过,但我得到了实际请求的400回复,响应如下
{
"code": 3,
"message": "Unexpected token.\AAAAASIKAF5etnRlbkFw\n^",
"details": [
{
"@type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": [],
"detail": "internal"
}
]
}
我认为这是从谷歌端点(Google Endpoints)回来的,这导致人们相信grpc网络支持可能还没有完全实现
有人能做到这一点吗?事实证明,正如问题中链接的拉取请求的对话所示(我稍后也进行了测试),问题是我试图使用谷歌云端点不支持的grpc web文本协议 经过一些测试,我可以确认Google云端点确实支持grpc web,但只支持二进制wire格式,这意味着不支持服务器流,只支持一元调用