nginx + grpc-web

Maxim Dounin mdounin at mdounin.ru
Fri Jun 29 15:12:33 UTC 2018


Hello!

On Thu, Jun 28, 2018 at 11:19:38AM -0400, donald.williams.0018 wrote:

> I try to use  nginx + grpc + grpc-web client JS library
> (https://github.com/grpc/grpc-web). 
> 
> Nginx-1 is compiled using the following setup:
>     nginx version: nginx/1.15.0
>     built by gcc 7.2.0 (Ubuntu 7.2.0-8ubuntu3.1~16.04.york0)
>     built with OpenSSL 1.0.2g  1 Mar 2016
>     TLS SNI support enabled
>     configure arguments: --with-threads --with-file-aio
> --with-http_ssl_module --with-http_v2_module

[...]

> If I use Nginx-2, the web JS client can connect to the service.
> 
> For Nginx-1, the web JS client cannot connect to the service. Nginx returns
> the following error:
>     [error] 26125#26125: *1 upstream rejected request with error 2 while
> reading response header from upstream, client: 192.168.50.101, server:
> localhost, request: "POST /helloworld.Greeter/SayHello HTTP/1.1", upstream:
> "grpc://127.0.0.1:50051", host: "localhost:8080", referrer:
> "http://localhost:8080/hello.html"

[...]

> It seems that Nginx-1 might have some issue with the encoding or the
> translation of http1 to http2. Do you have any suggestion of what is the
> issue? 

gRPC and gRPC-Web are different protocols.  gRPC-Web clients 
cannot connect to gRPC services without special translation from 
gRPC-Web to gRPC, and this is not something gRPC proxy module in 
nginx does.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list