tonic icon indicating copy to clipboard operation
tonic copied to clipboard

tonic-web: proxy any kind of service

Open bouk opened this issue 3 months ago • 0 comments

This allows applying the GrpcWebLayer to any kind of Service, not just ones that tonic generates.

Motivation

This makes it possible to use tonic-web as a grpc-web proxy to a gRPC server implemented in another language for example, I'm using it to proxy a Python gRPC service over grpc-web.

Solution

We have to be generic over the ResBody of the wrapped service and then box that into a tonic::body::Body. I've made the default values of the body type parameters tonic::body::Body so I believe this change is backwards compatible.

This is a redo of https://github.com/hyperium/tonic/pull/1366

bouk avatar Oct 07 '25 12:10 bouk