Grpc-web: Why is envoy proxy required?

Created on 29 Oct 2018  路  6Comments  路  Source: grpc/grpc-web

If the browser supports http/2, why does grpc-web require a envoy proxy?
is it just for older browser that do not support http/2 or?

Note: quite new to grpc and http/2

Most helpful comment

It's a fair question. When you say "browser supports http/2", it is in the context of transparently converting a regular HTTP 1.1 request and "upgrades" the connection to a http/2 one. However, for gRPC-Web to work, we need a lot of the underlying transport to be exposed to us but that's not the case currently cross browsers. We cannot leverage the full http2 protocol given the current set of browser APIs.

All 6 comments

I think your question belongs to stackoverflow. And grpc !== http/2 grpc-web leverages on http/2. Hope this article helps. A comparison with grpc will be something like REST and websockets.
https://stackoverflow.com/questions/44877606/is-grpchttp-2-faster-than-rest-with-http-2

Basically grpc and http2 is not the same thats why you need a proxy. If you want the details of the difference you can read the readme below..
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md

It's a fair question. When you say "browser supports http/2", it is in the context of transparently converting a regular HTTP 1.1 request and "upgrades" the connection to a http/2 one. However, for gRPC-Web to work, we need a lot of the underlying transport to be exposed to us but that's not the case currently cross browsers. We cannot leverage the full http2 protocol given the current set of browser APIs.

@weilip1803 thanks for those resources. I understand grpc is not http/2
@stanley-cheung thanks for that quick reply, thats what I was looking for. So in future when browsers have full htt2 protocol, will that eliminate the requirement for the proxy, correct?

@dv29, it is not that browsers don't have full http2 protocol, rather it is how much of the http2 transport is exposed to the application. For example, gRPC relies on trailing headers but browsers don't expose those.

@srini100 Got it, do you have any document reference that I can read maybe?

I found this to be useful to understand the wire format differences. As you can see, the proxy is essentially needed to convert between grpc-web and native protocol.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NiNJAD3vel0per picture NiNJAD3vel0per  路  3Comments

graup picture graup  路  4Comments

sirudog picture sirudog  路  3Comments

developerlaoz picture developerlaoz  路  3Comments

JuliusKoronci picture JuliusKoronci  路  4Comments