5

I want to

  • write my backend code with Java,
  • use HTTP/2 (NGINX 1.9.5 has been supported HTTP/2),
  • write a bidirectional stream to send data between client and server at any time.

gRPC seems to be the best choice and I want use NGINX as my reverse proxy and loading balancing, I could not find any documentation to figure out how to use NGINX with gRPC Java, does anyone know?


I saw the gRPC PHP has already supported NGINX: https://github.com/grpc/grpc/tree/master/src/php#use-the-grpc-php-extension-with-nginxphp-fpm

But I also saw there is an issue said it is in the process of submitting a 3rd party module in NGINX for gRPC support, and there is a ticket on NGINX means we can't write HTTP/2 NGINX proxy module for gRPC, and I also saw nginx does not support the full HTTP/2 specs, gRPC does not work through it

I'm confused about that, why do some posts say gRPC PHP works but in other posts it says it can't.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Jacks Gong
  • 694
  • 8
  • 18

2 Answers2

4

Not on nginx, but I just published a grpc-proxy written in Go. It's lightweight and configurable, and there is a docker image available.

csalazar
  • 748
  • 1
  • 7
  • 13
0

Yeah, nowdays, gRPC/HTTP2 with or without TLS are indeed fully supported on NGINX, as long as you have version 1.13.9 (if you just install the docker image with either alpine or latest tags then it'll be the right version).

As of (at least) late 2020 there is full support for it. Here's a link to their official Documentation:

https://www.nginx.com/blog/nginx-1-13-10-grpc/

Ben Neighbour
  • 55
  • 3
  • 15
  • To be honest, it's really not that different/complicated - I am trying to use mine as an API Gateway because Spring Cloud Modules like Netflix Zuul and Spring Cloud Gateway STILL can't support both HTTP/2 or gRPC forwarding in early 2021 - which is a disappointment because they have many other good features and are much less hassle to configure.... – Ben Neighbour Jan 07 '21 at 18:11
  • Here's a GitHub Issue on it - in case there are any future updates to this - https://github.com/spring-cloud/spring-cloud-gateway/issues/40 – Ben Neighbour Jan 07 '21 at 18:12