What is gRPC-Web? Calling gRPC services from a browser
gRPC-Web provides a browser client API and a browser-oriented transport protocol for web code to call a gRPC backend. Browsers do not expose all native gRPC HTTP/2 framing and trailer behavior directly, so a compatible proxy such as Envoy commonly forwards gRPC-Web requests to the native gRPC backend. The current gRPC-Web JavaScript implementation supports unary and some server-streaming calls, but not client-streaming or bidirectional streaming. Check the current capabilities of the specific client and transport mode before adopting it.
gRPC-Web provides a browser client API and a browser-oriented transport protocol for web code to call a gRPC backend. Browsers do not expose all native gRPC HTTP/2 framing and trailer behavior directly, so a compatible proxy such as Envoy commonly forwards gRPC-Web requests to the native gRPC backend. The current gRPC-Web JavaScript implementation supports unary and some server-streaming calls, but not client-streaming or bidirectional streaming. Check the current capabilities of the specific client and transport mode before adopting it.
How it differs from native gRPC
Native gRPC uses the .proto contract and Protobuf messages over a transport that assumes HTTP/2 behavior. Browser HTTP request/response APIs do not expose every part of that transport to application code. gRPC-Web uses a different browser protocol, commonly translated by a proxy to native gRPC for the backend. Even when the same .proto service definition is reused, verify the transport path and supported RPC shapes between browser and server.
Browser gRPC-Web client
│ browser-oriented HTTP request
▼
Compatible proxy, such as Envoy
│ native gRPC over HTTP/2
▼
gRPC backendThe protocol avoids depending on HTTP/2 framing that browsers do not expose. It also represents gRPC status and trailer information in frames in the response body. Text mode can use Base64 encoding; a binary Protobuf mode is also available. Configure the generated client and server path to use a matching mode and content type.
Check support by RPC shape and transport mode
The current gRPC-Web JavaScript repository says it supports unary and server-streaming RPCs, with server streaming only in grpcwebtext mode. The grpcweb binary mode supports unary calls only. Client-streaming and bidirectional streaming are listed as unsupported. This is implementation-specific; do not assume it applies to every library or later release.
| Needed call | What to check in the gRPC-Web JavaScript implementation |
|---|---|
| Unary | Supported; align service and message configuration across server, proxy, and client |
| Server streaming | Currently documented for grpcwebtext mode |
| Client streaming | Currently documented as unsupported |
| Bidirectional streaming | Currently documented as unsupported |
If browser-side client streaming or bidirectional interaction is essential, do not assume gRPC-Web fits. Evaluate whether another browser transport or API design can provide the required semantics. Server streaming is not interchangeable with bidirectional streaming.
Configure the browser-to-backend path
The official basic example generates a browser client from the same .proto and runs a gRPC backend plus an Envoy proxy. Use settings that match the chosen implementation and infrastructure version in a real product.
Define the service and request/response messages in `.proto`; confirm that the selected client supports each needed RPC shape.
Implement the gRPC service in the backend and provide an HTTP/2 gRPC endpoint.
Generate the browser client stub with the gRPC-Web plugin; choose binary or text mode and the import style.
Configure a compatible proxy, such as Envoy, with the gRPC-Web filter and an upstream to the backend.
If the browser app and backend have different origins, configure CORS for the actual request methods, headers, and authentication; inspect preflight and responses in the browser network panel.
Check success and error responses in a development browser, then verify the same proxy path, TLS, and authentication policy in deployment.
Do not copy example configuration into production unchanged. CORS scope, TLS termination, authentication metadata forwarding, proxy timeouts, and message-size limits must fit the service's security and operational contract. This article does not report a deployed setup or test.
Diagnose failures
If the browser sends no request or preflight fails, inspect the browser console/network panel for origin, CORS response, and allowed headers.
For proxy 404 or routing errors, check the gRPC-Web filter, path matching, backend cluster, and HTTP/2 upstream.
For serialization or decode errors, compare the generated client and server `.proto` versions, transport mode, and content type.
If the call connects but streaming fails, first check whether that RPC-shape/mode combination is supported, especially the binary mode's unary-only limit.
For browser-visible errors, inspect the final gRPC status carried in the gRPC-Web response body and the proxy logs, not only the HTTP status.
When to choose it
Consider gRPC-Web when a browser needs to reuse a Protobuf contract and gRPC backend, the required calls fit the supported modes, and the team can operate a compatible proxy plus CORS and authentication paths. If broad HTTP/JSON tooling or unsupported streaming matters more, compare REST/JSON, HTTP JSON transcoding, or another transport contract. Decide from call semantics and browser/proxy constraints, not the name or serialization efficiency alone.
Sources
[gRPC-Web basics tutorial](https://grpc.io/docs/platforms/web/basics/)
[gRPC-Web JavaScript implementation and support](https://github.com/grpc/grpc-web)
[gRPC-Web protocol differences](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md)
[gRPC-Web streaming roadmap](https://github.com/grpc/grpc-web/blob/master/doc/streaming-roadmap.md)