grpc / grpc/grpc-web

Use Nginx in front of Envoy

Open
#1,213 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
802
Avg merge
1d 7h
Merged PRs (30d)
5

Description

Hey,
I am currently setting up a new webapp I have been building using gRPC as a backend and I want to now send my client gRPC requests to Nginx on my domain `domain/api` which then should forward it to the Envoy proxy running on port `:8000`. The architecture looks roughly like this:

![image](https://user-images.githubusercontent.com/15003401/157729367-1d7e7ffe-3595-496f-95ed-6dd101da867c.png)

Now in my webapp I want to create a new client to send the data to my service like this:
```typescript
this.service = new Client("/api", null, null);
```
This doesn't work and I am getting the error:
```
grpc-message: "unknown service api/proto.Service"
grpc-status: "12"
```

If I expose the Envoy port and send the requests there directly with
```typescript
this.service = new Client("http://domain.com:8000", null, null);
```
it works perfectly but I would rather send the request to Nginx first and let it distribute to Envoy.

My `nginx.conf` looks like the following:
```conf
server {
listen 80;
root /var/www/domain.com/html;
index index.html index.htm index.nginx-debian.html;

server_name domain.com www.domain.com;

location /api {
proxy_http_version 1.1;
proxy_pass http://localhost:8000;
proxy_set_header Connection "";
}

location / {
try_files $uri $uri/ /index.html$is_args$args;
}
}
```

My question is now how do I fix it and get Nginx to forward the requests correctly while sending the requests to `domain.com/api`.

Thanks a lot for any help :)
Best,
Leon

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.