As seen in the changelog of the esp proxy for Google endpoints (https://github.com/cloudendpoints/esp/pull/283) support for grpc-web has been added for it.
I am however unable to get it to work. I deployed the esp with the following cors configuration
# 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;
And then configured a GRPC Google endpoint.
When I attempt to send a grpc-web request to that endpoint, I can see that the OPTIONS
request goes through but I get a 400 back on the actual request with the following response
{
"code": 3,
"message": "Unexpected token.\AAAAASIKAF5etnRlbkFw\n^",
"details": [
{
"@type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": [],
"detail": "internal"
}
]
}
I think this is coming back from Google Endpoints which leads to believe that grpc-web support might not be fully there yet.
Has anybody managed to get this working?