What is gRPC-Web, why can't browsers use gRPC directly, and why is a proxy required?
Last updated
Browsers can't speak native gRPC because Fetch/XHR don't expose HTTP/2 framing, full-duplex control or trailers (where
grpc-statuslives).gRPC-Web is a browser-compatible variant that packs trailers into the response body. It supports unary and server streaming only.
A proxy (e.g. Envoy's gRPC-Web filter) is required to translate gRPC-Web requests into standard gRPC for the backend and convert responses back.
- https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md
- https://grpc.github.io/grpc/core/md_doc__p_r_o_t_o_c_o_l-_w_e_b.html
- https://learn.microsoft.com/en-us/aspnet/core/grpc/browser?view=aspnetcore-10.0
- https://envoy-guide.vercel.app/learn/real-world-recipes/grpc-routing
- https://medium.com/@QuarkAndCode/grpc-for-microservices-http-2-streaming-grpc-web-routing-da556bf32324
- https://hedera.com/blog/what-is-grpc-grpc-web-and-proxies/
- https://kreya.app/blog/grpc-web-deep-dive/
- https://dev.to/tjindapitak/why-grpc-is-not-natively-supported-by-browsers-3oj5