Search code examples
grpctraefikgrpc-javagrpc-web

Java Grpc server behind the Traefik proxy


This is my traefik configuration


[entryPoints]
  [entryPoints.http]
  address = ":81"

[file]
 [backends]
   [backends.backend1]
     [backends.backend1.servers.server1]
     url = "h2c://10.141.11.230:6566"
 [frontends]
   [frontends.frontend1]
   entryPoints = ["http"]
   backend = "backend1"

When grpc server is being invoked by js web client via traefik proxy, I'm getting this warning on server side

WARN 22160 --- [-worker-ELG-3-1] io.grpc.netty.NettyServerHandler         : Expected header TE: trailers, but null is received. This means some intermediate proxy may not support trailers

The service method is not invoked.

Client get's 415 (Unsupported Media Type) response.

Traefik 1.7.16

Grpc-java 1.22.1

[email protected]

What am I missing ? Thanks


Solution

  • The TE: trailers warning is a false alarm in your situation; I've created a grpc-java PR to prevent it in the future.

    The 415 is the true failure. That means that the client is using a content-type that isn't application/grpc. This is because grpc-web uses an alternate protocol which needs to be converted. Converting the protocol is typically done with a proxy; that's what the Envoy proxy does that's mentioned on the grpc-web repository.