grpc / grpc/grpc-rust

URI path is not respected in Endpoint

Open
#1,314 9 comments 0 reactions 0 assignees View on GitHub
A-tonic C-bug
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Bug Report

### Version

tonic v0.8.3
tonic-build v0.8.4

### Platform

Linux blade 6.2.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 15:58:31 +0000 x86_64 GNU/Linux

### Description

Tonic client does not respect endpoint path.

Trying to proxy my grpc service via nginx, I have the following nginx configuration:

```nginx
http {
server {
listen 50050 http2;
server_name main;

location /grpc {
grpc_pass grpc://core:50055;
}
}
}
```

And the client builds the endopoint like so:

```rust
let endpoint = Endpoint::from_static("http://localhost:50050/grpc");
```

I expected the request to go to `/grpc` path but it does not. Nginx logs show that POST requests go to `/` instead of `/grpc`. I also verified that changing nginx configuration to `location /` does work even though the client-side endpoint still indicates the `/grpc` path.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.