Chapter 31: gRPC-Web and Browser Clients

The Problem: Browsers Can't Speak gRPC

Browsers don't support HTTP/2 trailers (needed for grpc-status) or raw binary framing. gRPC-Web is a modified protocol that works in browsers.

Architecture

Browser (gRPC-Web client) │ HTTP/1.1 or HTTP/2 (no trailers) ▼ Envoy Proxy (translates gRPC-Web → gRPC) │ Full gRPC (HTTP/2 + trailers) ▼ gRPC Server (unchanged)

Limitations

Alternative: gRPC-Gateway (REST + gRPC)

Generate a REST API automatically from your .proto file. Browsers use REST, internal services use gRPC. Best of both worlds.