1

When i set $var in grpc_pass i can't connect grpc-client to server, I get the FAIL error

   [Microsoft.Extensions.Hosting.Internal.Host)
   [BackgroundServiceFaulted status   BackgroundServledGrpc.Co.RpcException
(StatusCode="Unknown", Detail="Bad gRPC response. HTTP status code: 500")

The purpose of setting a variable is to bypass the situation where one of the services that proxies NGINX crashes, and when NGINX restarts, the other services continue to work.

With proxy_pass directive all works and tests are successful (Setup nginx not to crash if host in upstream is not found), with grpc_pass - no, BUT in manual says that

Parameter value can contain variables (1.17.8). In this case, if an address is specified as a domain name, the name is searched among the described server groups, and, if not found, is determined using a resolver.

version:

# nginx -v
nginx version: nginx/1.23.2

path myexamplenginx_conf:

  location / {
        resolver 127.0.0.11 valid=30s;
        set $webuidev https://dev_webuidev;
        proxy_pass $webuidev;

        #proxy_pass https://dev_webuidev;
        # Configuration for WebSockets
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_cache off;
        # WebSockets were implemented after http/1.0
        proxy_http_version 1.1;
        # Configuration for ServerSentEvents
        proxy_buffering off;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;   
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-URL-SCHEME https;
    }
    location /App.Room.Api.Contract.ApiService/UpdateOpcDaTags {
        resolver 127.0.0.11 valid=30s;
        set $grpc_webuidev grpcs://dev_webuidev;
        grpc_pass $grpc_webuidev;

        #grpc_pass grpcs://dev_webuidev;
    }

0 Answers0