After racking my brains over and over, I solved it like this.
underscores_in_headers on;
location / {
grpc_read_timeout 300s;
grpc_send_timeout 300s;
grpc_socket_keepalive on;
if ($http_content_type = "application/grpc") {
grpc_pass
grpc://collector.teste.com.br:4317;
}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
}
I added this configuration to the advanced nginx proxy manager for the domain I created, pointing to 4317.