0

I have a gRPC Java app and I configured Fabio to balance the load (I will be running 2+ instances of app) and CloudFlare for proxy.

What I have done so far:

Nginx reverse proxy setup

server {
    listen [::]:443 ssl http2 ipv6only=on;
        listen 443 ssl http2;

    server_name grpc.example.com;

    location /{
        grpc_pass grpc://127.0.0.1:9999;
    }
        ssl_certificate /etc/letsencrypt/live/grpc.example.com/fullchain.pem; 
        ssl_certificate_key /etc/letsencrypt/live/grpc.example.com/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

}

CloudFlare setup:
Grpc is enabled

Subdomain configuration for domain (IP is random in picture)
subdomain

Fabio setup
gRPC app runs in a Docker container

running app

When I connect to this server using gRPC client, I get nginx error "502 Bad Gateway".

I can see from access.log that request actually reaches with http/2.0 but I am confused and I don't know where to look for problem.

Also error.log shows this for requests:

2022/12/12 23:38:45 [error] 506072#506072: *1020 upstream sent too large http2 frame: 4740180 while reading response header from upstream, client: 61.142.22.151, server: grpc.example.com, request: "POST /Syncer/doUpdate HTTP/2.0", upstream: "grpc://127.0.0.1:9999", host: "grpc.example.com:443"

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
rgaraisayev
  • 398
  • 3
  • 13
  • Take a look at https://github.com/kubernetes/ingress-nginx/issues/4323#issuecomment-1162939699 What serves on port 9999? It looks like that replies with HTTP1. – Yuri Golobokov Dec 15 '22 at 23:37
  • Thank you for sharing this info. 9999 is Fabio which redirect traffic to grpc backend. You are right, when nginx sends request to 9999, Fabio responds with http1. Probably, configuration is not right, so it cannot redirect request from nginx to grpc – rgaraisayev Dec 17 '22 at 18:46
  • I found a solution. Enabled grpc protocol in fabio, it works now – rgaraisayev Dec 17 '22 at 21:48
  • @rgaraisayev Could you please copy your solution in the answer so this question has a verified answer? – San P Dec 19 '22 at 00:53

1 Answers1

1

Adding GRPC listener with port solved the issue

proxy.addr = :8888;proto=grpc
rgaraisayev
  • 398
  • 3
  • 13