grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

Replace `x-grpc-web` header with `X-User-Agent`

Open jonny-improbable opened this issue 6 years ago • 2 comments

As originally discussed in #331, improbable-eng/grpc-web could become more compliant with the gprcweb spec by removing the x-grpc-web header and replacing it with an X-User-Agent header which carries the hard-coded value of grpc-web-javascript/0.1.

This change would need to be made in both the client and the server.

jonny-improbable avatar Feb 12 '19 18:02 jonny-improbable

Note that making this change will prevent us from detecting grpcweb requests in the CORS Preflight (OPTIONS request) handler (see discussion in https://github.com/grpc/grpc-web/issues/85).

If implemented, the grpcweb middleware will handle all CORS preflight requests, whereas before this change, it would only handle those originating from a grpcweb client (identified by the x-grpc-web` header.

jonny-improbable avatar Feb 12 '19 20:02 jonny-improbable

If anyone is interested, I was having trouble getting Grpc.Net.Client.Web (used through a Blazor WebAssembly application) working with grpcwebproxy.

I found that the check for x-grpc-web in the access control request headers was preventing further communication.

I'm not familiar enough with gRPC to have an appropriate solution, but replacing it with "grpc-accept-encoding" seemed to do the trick.

conmilo avatar Jan 30 '20 19:01 conmilo