File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,19 @@ const metadataTrailerPrefix = "Grpc-Trailer-"
1414/*
1515AnnotateContext adds context information such as metadata from the request.
1616
17- If there are no metadata headers in the request, then the context returned
18- will be the same context.
17+ At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For",
18+ except that the forwarded destination is not another HTTP service but rather
19+ a gRPC service.
1920*/
2021func AnnotateContext (ctx context.Context , req * http.Request ) context.Context {
2122 var pairs []string
23+
24+ // Include the original RemoteAddr, something the gRPC service may need in the ctx
25+ pairs = append (pairs , "RemoteAddr" , req .RemoteAddr )
26+
2227 for key , vals := range req .Header {
2328 for _ , val := range vals {
24- if strings . ToLower ( key ) == "authorization " {
29+ if key == "Authorization " {
2530 pairs = append (pairs , key , val )
2631 continue
2732 }
You can’t perform that action at this time.
0 commit comments