Using gRPC nginx gateway

babu vel babuvel_d at hotmail.com
Fri Jun 4 15:44:22 UTC 2021


Hi Maxim,

It's not in upstream block. It's in server block. Please refer code snip below.

    upstream backend_grpc {
        server unix:/tmp/nginx_local/grpc_be_management.sock;
    }

  server {
        listen       443 http2 default_server;

        ssl                  on;
        ssl_certificate      default.crt;
        ssl_certificate_key  default.key;

        ssl_session_timeout  5m;

....

        location /gnmi {
            grpc_pass grpc://backend_grpc;
            set $grpc_client_cert_auth 1;
            if ($ssl_client_verify != SUCCESS){
                set $grpc_client_cert_auth 0;
            }
            client_body_timeout 2000000;
            #grpc_read_timeout 2000000;

            #grpc_set_header cl_cert_s_dn $ssl_client_s_dn;
            #grpc_set_header cl_cert_status $grpc_client_cert_auth;
        }
    }

Regards,
Babu

________________________________
From: Maxim Konovalov <maxim at nginx.com>
Sent: Friday, June 4, 2021 2:15 AM
To: nginx at nginx.org <nginx at nginx.org>; babu vel <babuvel_d at hotmail.com>
Subject: Re: Using gRPC nginx gateway

Hi Babu,

On 04.06.2021 10:54, babu vel wrote:
> Hi,
>
> Am using nginx 1.17.3 version and trying to enable http2 and gRPC
> gateway. I compiled it enabling http_v2 and gRPC module. However, am
> still getting below error reporting unknown directive "grpc_pass", can
> you please let me know what is the issue here?
>
> # nginx -c /nginx/conf/grpc.conf -t
> nginx: [emerg] unknown directive "grpc_pass" in /nginx/conf/grpc.conf:165
> nginx: configuration file /nginx/conf/grpc.conf test failed
> #
>
> # cat -n /nginx/conf/grpc.conf | grep -i http2
>     88          listen       443 http2 default_server;
> # cat -n /nginx/conf/grpc.conf | grep -i grpc
>     83      upstream backend_grpc {
>     84          server unix:/tmp/nginx_local/grpc_be_management.sock;
>    165              grpc_pass grpc://backend_grpc;
>    166              set $grpc_client_cert_auth 1;
>    168                  set $grpc_client_cert_auth 0;
>    171              #grpc_read_timeout 2000000;
>    173              #grpc_set_header cl_cert_s_dn $ssl_client_s_dn;
>    174              #grpc_set_header cl_cert_status $grpc_client_cert_auth;
> #
>
[...]

You cannot really use this directive in the upstream block, see

http://nginx.org/r/grpc_pass

--
Maxim Konovalov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20210604/a6c03f06/attachment.htm>


More information about the nginx mailing list