Conversation
| if !ok { | ||
| return status.Error(codes.Internal, ":authority header has not been set") | ||
| } | ||
| authority, ok := md[":authority"] |
There was a problem hiding this comment.
is there any way of connecting these keys back to the upstream definition?
There was a problem hiding this comment.
This seems incorrect. x-forwarded-for is the list of peers forwarding the request. the authority is the intended destination of the request.
There was a problem hiding this comment.
This looks strange to me as well - I'm not clear on how x-forwarded-host and authority are related.
If you want to record the caller, then x-forwarded-for seems like a good choice. X-forwarded-for is implemented in my fork: https://github.com/vgough/grpc-proxy/blob/master/proxy/handler.go
| // TODO(mwitkow): Add a `forwarded` header to metadata, https://en.wikipedia.org/wiki/X-Forwarded-For. | ||
| md, ok := metadata.FromIncomingContext(clientCtx) | ||
| if !ok { | ||
| return status.Error(codes.Internal, ":authority header has not been set") |
There was a problem hiding this comment.
Why is this now an error? seems like a breaking change.
|
|
||
| clientCtx, clientCancel := context.WithCancel(outgoingCtx) | ||
| // TODO(mwitkow): Add a `forwarded` header to metadata, https://en.wikipedia.org/wiki/X-Forwarded-For. | ||
| md, ok := metadata.FromIncomingContext(clientCtx) |
There was a problem hiding this comment.
extract to function, link to relevant docs (i.e. wikipedia)
No description provided.