grpc-proxy icon indicating copy to clipboard operation
grpc-proxy copied to clipboard

proxy pass header metadata

Open liule opened this issue 7 years ago • 4 comments

Metadata can't pass client to server by grpc-proxy, what can I do to pass metadata , thanks a lot

liule avatar Jun 06 '17 13:06 liule

There's a fork by @kruczjak at https://github.com/kruczjak/grpc-proxy which supposedly does that, but it crashes for me.

panic: interface conversion: *proxy.frame is not proto.Message: missing method ProtoMessage

goroutine 14 [running]:
panic(0x7ce140, 0xc420017280)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/mwitkow/grpc-proxy/proxy.protoCodec.Marshal(0x791400, 0xc420272520, 0xc4202c3d78, 0x46d2c9, 0xc420284280, 0xc4201806c9, 0x7)
        /go/src/github.com/mwitkow/grpc-proxy/proxy/codec.go:61 +0x61
github.com/mwitkow/grpc-proxy/proxy.(*protoCodec).Marshal(0xa60190, 0x791400, 0xc420272520, 0x0, 0x0, 0x7, 0x7, 0x0)
        <autogenerated>:1 +0x60
github.com/mwitkow/grpc-proxy/proxy.(*rawCodec).Marshal(0xc4202781a0, 0x791400, 0xc420272520, 0x0, 0x0, 0xc4202c3d78, 0x531a1b, 0xc420284280)
        /go/src/github.com/mwitkow/grpc-proxy/proxy/codec.go:38 +0x9e
google.golang.org/grpc.encode(0x7feddb04d040, 0xc4202781a0, 0x791400, 0xc420272520, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4202c3e90, ...)
        /go/src/google.golang.org/grpc/rpc_util.go:378 +0x2ea
google.golang.org/grpc.(*clientStream).SendMsg(0xc4202565a0, 0x791400, 0xc420272520, 0x0, 0x0)
        /go/src/google.golang.org/grpc/stream.go:387 +0x11a
github.com/simonhorlick/grpc-proxy/proxy.(*handler).forwardServerToClient.func1(0xa1b620, 0xc4202821e0, 0xc4200116e0, 0xa1b5c0, 0xc4202565a0)
        /go/src/github.com/simonhorlick/grpc-proxy/proxy/handler.go:162 +0xb3
created by github.com/simonhorlick/grpc-proxy/proxy.(*handler).forwardServerToClient
        /go/src/github.com/simonhorlick/grpc-proxy/proxy/handler.go:167 +0x89

I'm at my wits' end with a sane way to route grpc to multiple services… traefik won't do it, ambassador doesn't handle ALPS, grpc-proxy is almost perfect but it eats my authentication. Is @devsu actually using this, and do you intend to maintain it? Because I think it's a great addition to the scene, at least until such a time as something like Conduit matures.

lalomartins avatar Feb 10 '18 11:02 lalomartins

Okay, so here's some more info on it.

Proxying metadata used to work automatically. Then the go grpc implementation changed in (1.5 I think?) to separate incoming and outgoing contexts. Unfortunately, it doesn't seem the version in your public docker image works.

The grpc-proxy library is fixed to handle this. (As of this writing the issue is still open but the latest commit actually fixes it, or should.)

Here's an example of how one would use the new interface.

But I tried to apply the same to grpc-proxy and I get stream terminated by RST_STREAM with error code: INTERNAL_ERROR. You can see my code here in case it's useful.

lalomartins avatar Feb 10 '18 14:02 lalomartins

Hi @lalomartins. Sorry, At devsu we're not using the project anymore, and don't have plans to use it in the near future. Because of that we cannot commit to maintain it... if anyone is interested in maintain it, feel free to make a fork and continue from there.

c3s4r avatar Feb 14 '18 14:02 c3s4r

I figured as much. I ended up getting it to work using ingress-nghttpx. I'd be interested in hearing what you're using (if you're using anything).

Otherwise, might I suggest putting a banner on the readme or somewhere stating it's not maintained?

Thanks for the great work though!

lalomartins avatar Feb 14 '18 14:02 lalomartins