When I read the gRPC-Web documentation, I was surprised to see Envoy used without any explanation:
gRPC uses HTTP2. Since modern browsers are able to communicate over HTTP2, I don't see the need to set up a proxy if I support only such browsers. Why do I need a proxy like Envoy nonetheless?
There is a hint in the documentation describing the gRPC-Web protocol:
decouple from HTTP/2 framing which is not, and will never, be directly exposed by browsers - grpc/PROTOCOL-WEB.md at master · grpc/grpc
- So that a proxy is required.
And I think the restriction will never be removed.
Why am I so sure that browser will keep the restriction?
The reason can be explained by considering the position of HTTP2 in the public Web. HTTP/1.1 has been used on the Web for a long time. So you can expect your web servers to be able to communicate over HTTP/1.1. However, it is not clear whether they can communicate over HTTP2. Therefore, a browser uses HTTP2 if it can communicate with a web server over HTTP2, but otherwise, it will fall back to HTTP/1.1.
gRPC uses the such HTTP2-only feature.