server {
listen 50051 http2;
location / {
grpc_pass grpc://backend:50052;
}
}When NGINX proxies a gRPC request correctly to a healthy backend, it returns HTTP/2 200 OK status.
server {
listen 443 ssl http2;
ssl_certificate /etc/ssl/certs/server.crt;
ssl_certificate_key /etc/ssl/private/server.key;
location / {
grpc_pass grpc://127.0.0.1:50051;
}
}A 502 error indicates NGINX could not reach the backend gRPC server at 127.0.0.1:50051. The SSL config is for client connections, not backend connectivity.
grpc_read_timeout sets the timeout for reading a response from the gRPC backend. proxy_read_timeout is for HTTP proxying, not gRPC.
You must have the backend running before configuring NGINX to proxy it. Then reload NGINX and test the connection.
gRPC responses including errors use HTTP/2 200 with grpc-status trailer set to 14 (UNAVAILABLE). Returning 503 or other 5xx makes it an HTTP transport error, not a proper gRPC status.
