gRPC-Web over HTTP/3

gRPC-Web is a proxy protocol for accessing gRPC services from browsers, built on top of simple HTTP requests that browsers support.

Native gRPC relies on HTTP/2, and there is ongoing discussion regarding HTTP/3 support.

It’s not obvious whether gRPC-Web supports HTTP/3. Given its purpose of browser support, it works not only on HTTP/2 but also on HTTP/1.1.

There have been no protocol updates or precedents for standardization for gRPC-Web.

gRPC-Web seemingly works on HTTP/3

In reality, when a frontend proxy provides HTTP/3, gRPC-Web also operates on HTTP/3. For instance, Google’s application load balancer among its load balancer products provides HTTP/3, and when providing gRPC-Web services behind it, connections are made over HTTP/3.

The specific version of HTTP used for each connection depends on a browser. It is speculated that gRPC-Web client libraries often implement using the fetchAPI, and in the case of Chrome, it actively utilizes HTTP/3 for fetch().

Since HTTP/3 connects via Quic/UDP, performance improvements can be expected as a WAN protocol. However, this browser behavior also indicates that individual gRPC-Web services have no means of controlling the HTTP version.

Although our production clusters unintentionally ended up with gRPC-Web over HTTP/3 configurations, no issues have occurred, even including server-side streaming. We have good results of reproducing the actual configuration with our test suites, and it’s safe to say that it’s been operating stably.

gRPC-Web over HTTP/3 configuration

The functionality of the GCP load balancer automatically enables gRPC-Web to support HTTP/3, so we haven’t verified the necessary configuration. However, the load balancer only performs protocol conversion and minimal HTTP header manipulation.

For gRPC-Web proxies, Envoy is often adopted. It is presumed that by defining downstream settings for HTTP/3 in addition to the existing upstream settings, gRPC-Web can be delivered over HTTP/3. Specifically, it should suffice to configure HTTP/3 on the UDP port downstream of Envoy and advertise alt-svc on the TCP port for HTTP/2.

中馬崇尋
Chuma Takahiro