{"action":"opened","issue":{"url":"https://api.github.com/repos/gengo/grpc-gateway/issues/173","repository_url":"https://api.github.com/repos/gengo/grpc-gateway","labels_url":"https://api.github.com/repos/gengo/grpc-gateway/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/gengo/grpc-gateway/issues/173/comments","events_url":"https://api.github.com/repos/gengo/grpc-gateway/issues/173/events","html_url":"https://github.com/gengo/grpc-gateway/issues/173","id":158443520,"number":173,"title":"remote peer address is lost in ctx - always resolves to localhost","user":{"login":"mikeatlas","id":12704,"avatar_url":"https://avatars.githubusercontent.com/u/12704?v=3","gravatar_id":"","url":"https://api.github.com/users/mikeatlas","html_url":"https://github.com/mikeatlas","followers_url":"https://api.github.com/users/mikeatlas/followers","following_url":"https://api.github.com/users/mikeatlas/following{/other_user}","gists_url":"https://api.github.com/users/mikeatlas/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeatlas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeatlas/subscriptions","organizations_url":"https://api.github.com/users/mikeatlas/orgs","repos_url":"https://api.github.com/users/mikeatlas/repos","events_url":"https://api.github.com/users/mikeatlas/events{/privacy}","received_events_url":"https://api.github.com/users/mikeatlas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-03T20:00:07Z","updated_at":"2016-06-03T20:00:07Z","closed_at":null,"body":"Since grpc-gateway creates a HTTP REST service that then subsequently calls a gRPC client, the loopback network hop causes all requests at the gRPC service to appear to originate from `::1` (`localhost` in IPv6).\r\n\r\nExample gRPC service:\r\n```go\r\nfunc (r *myService) MyRPCEndpoint(\r\n\tctx context.Context, msg *grpcapi.Message) (*grpcapi.Message, error) {\r\n \tp, _ := peer.FromContext(ctx)\r\n\tremoteAddr := p.Addr.String() // ALWAYS localhost :(\r\n        // ... etc\r\n}\r\n```\r\n\r\nIt would be nice if [`X-Forwarded-For`](https://en.wikipedia.org/wiki/X-Forwarded-For) (or the newer `Forwarded` RFC header) were populated with the original external address, or that some other context field could be passed along with the request. \r\n\r\nI may make a PR for this as it's something I need right away, and don't see an obvious workaround."}}
{"actor":{"display_login":"mikeatlas"}}