Grpc-web proxy - missing trailers

Seems like traefik proxy is not sending grpc-status OK trailers for grpc-web proxy, as these are required by grpc-dart implementation:

grpc-web might need to default grpc-status to 0 when missing · Issue #566 · grpc/grpc-dart (github.com)

When debugging the issue I get response 200 and response content through grpc-web, but it is missing trailers and then grpc-dart implementation shows error. There is no such error with Envoy as grpc-web proxy with the same container configurations. So I presume that something weird happens in traefik h2c handler.

Hi @alenas! Thanks for your interest in Traefik!

Which version of Traefik do you use?

v3 comes with middleware for GRPC

I tried with docker images versions 2.9.6 and 3.0.beta2

My dynamic config is like this:

http:
  routers:
    grpc-web:
      entryPoints: grpc
      middlewares: testHeader
      service: srv-grpc-web
      rule: PathPrefix(`/`)

  services:
    srv-grpc-web:
      loadBalancer:
        servers:
        - url: h2c://127.0.0.1:5055

  middlewares:
    testHeader:
      headers:
        accessControlAllowMethods: 
          - GET
          - PUT
          - POST
          - OPTIONS
        accessControlAllowOriginList: '*'
        accessControlAllowHeaders: '*'
        accessControlExposeHeaders: 
          - custom-header-1
          - grpc-status
          - grpc-message
        accessControlMaxAge: 1728000

Hi @alenas, for Traefik v3, did you activate the middleware for gRPC-web?
It seems, I can't spot that in your config?

You are right :slight_smile: I changed middleware config for v3 and it works now.

  middlewares:
    testHeader:
      grpcWeb:
        allowOrigins:
          - "*"

Thanks a lot. Solved.