skip to Main Content

This works:

server {
    listen 5005 http2;
    
    location / {
        grpc_pass grpc://my_app:5001;
    }

    default_type application/grpc;
}

this doesnt work:

server {
    listen 5005 http2;
    
    location /test {
        grpc_pass grpc://my_app:5001;
    }

    default_type application/grpc;
}

I receive logs when I go to localhost:5005, it looks like this:

192.168.0.1 - - [20/Sep/2021:10:18:02 +0000] "POST /tasks.TasksServiceGRPC/AskForJob HTTP/2.0" 200 153 "-" "grpc-node/1.24.7 grpc-c/8.0.0 (windows; chttp2; ganges)" "-"

When I go to localhost:5005/test, I’m not even getting the logs in nginx

on http 1.1 everything is working fine

2

Answers


  1. Chosen as BEST ANSWER

    It is not possible with grpc, because of request structure


  2. You should set the location value as the grpc URL to which the client is referring. For example, for me this was the case

    location /App.ControlRoom.Api.Contract.ApiService/UpdateOpcDaTags {
            grpc_pass grpcs://cdpkat-dev_webuidev;
            }
    

    For you i think like this:

    server {
        listen 5005 http2;
        
        location /tasks.TasksServiceGRPC/AskForJob {
            grpc_pass grpc://my_app:5001;
        }
    
        default_type application/grpc;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search