grpc / grpc/grpc-web

Path prefixes: how?

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

Description

Hi all,

I have a very basic question and cannot find an answer yet.

This is what I have from docs:

```ts
const echoService = new EchoServiceClient('http://localhost:8080', null, null);
```

That's all fine until it comes to deployment to the real world where I have just one domain (let's say this is a limitation) and want to split the traffic by path prefixes as one normally does in REST.

In other words this is the desired URL structure:

- web app: https://example.com
- grpc-web proxy: https://example.com/grpc-proxy

and the configuration of the client would be

```ts
const echoService = new EchoServiceClient('https://example.com/grpc-proxy', null, null);
```

or even more preferrable

```ts
const echoService = new EchoServiceClient('/grpc-proxy', null, null);
```

There is an option to configure some sort of path prefix strip and make one more proxy step on the envoy itself, so it looks something like

```
browser => envoy proxy strip path prefix => envoy grpc web proxy => grpc server
```

However, it looks dirty.

And I am still unsure whether the `grpc-web` library itself is going to support the non-root path prefixes such as described above in the long run .

Is this possible? Is there an example how to configure envoy in this case?

Thanks in advance.

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.