-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Should metadata annotator include the headers from incoming matcher? #368
Comments
To be clear, any custom logic in metadata annotator can be also performed on the grpc server side after passing the full header. An example can be adding a new header |
On second thought, this is not needed. Custom logic can read the original |
I'm not sure it's related to this, but I think we should be able to add one specific cookie (or all of them) to the incoming metadata.MD of context, so that we don't have to iterate over |
@ilius ,
But if you want to only support cookie at gateway layer, this is what you can do:
|
We don't expose grpc to the outside world (only for inter-service communication), we only expose REST to outside. So I will try the second approach. |
The second approach does not seem to be working for us.
But I get this metadata:
It gives empty |
I also tried with both ServeMuxOptions to |
@ilius are you seeing that behavior if you supply a literal value instead of "tokenCookie.Raw" there in your example? |
@ilius , you should be using |
My apology. |
Glad it worked for you! |
@tmc https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/context.go#L97
Currently metadataAnnotator is passed the original
ctx
which does not include the metadata / headers. We can consider passing a context with the headers to metadata annotator. This will allow custom logic inside metadata annotator that depends on the http headers.cc: @ilius
The text was updated successfully, but these errors were encountered: