Re: [grpc-io] (grpc-web) How do I specify custom metadata ?

32 views
Skip to first unread message

Stanley Cheung

unread,
Mar 22, 2019, 12:48:56 PM3/22/19
to Rob Cecil, grpc.io
Hm, what you did was exactly right. 

In our example, here's how we passed "custom-header-1" (deliberately as an example on how to pass custom metadata)

and the metadata will make it to the other side like this:

This is rather curious. 

The only thing I can think of is that you are using the PromiseClient, where we have seen some runtime mismatch issue where someone is using the protoc plugin at HEAD but was using the released version of our npm package. 

We have just released 1.0.4 so perhaps can you try this again?

On Wed, Mar 13, 2019 at 12:46 PM Rob Cecil <rob....@gmail.com> wrote:
My existing c# based Grpc server uses a custom Http/2 metadata "access-token". How is this supported in Grpc-web? I changed my envoy.yaml:

 cors:
                allow_origin
:
               
- "*"
                allow_methods
: GET, PUT, DELETE, POST, OPTIONS
                allow_headers
: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,access-token,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
                max_age
: "1728000"
                expose_headers
: access-token,grpc-status,grpc-message
                enabled
: true


So, I am no longer seeing CORS errors in my browser console, but the token never makes it to the other side of the proxy. All I am seeing on my C# side, is "user-anger" in the metadata object.
I am creating a json object for the metadata in each rpc call in the web  client.

promiseClient.getUser(logInState.getCurrentuserinfo(), { "access-token": logInState.getAccesstoken() })

       
.then( ... ).catch (... )

THANKS

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b67d222e-a145-48fe-b6a3-0e9098581961%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages