HTTP & gRPC routing for the same app

Hello, does anyone please has an experience how proceed if your application is using two clients, one for HTTP and other for gRPC, and you want to route all requests with use of linkerd?

Because there is a conflict in setup of appropriate proxies through environment variables. As far as I know, linkerd does not support routing of HTTP & gRPC on the same port and therefore I need to set different proxy addresses for each of the clients. Unfortunatelly, both clients accept value in http_proxy environment variable and therefore I cannot use it…

GRPC implementation does not currently support set of proxy with use of API and accepts only value in http_proxy env. var. (I created an issue in their github but I don’t know how and when this will be solved). I was able to set a proxy for our HTTP clients through API, but we are also using OpenID and other third-party libraries and where it is not easy to setup (sometimes it cannot be set through API at all)…

Do you please have some proposal how to solve it? Thank you.

Hi @zsojma.

It sounds like you’ll probably need to explicitly configure your gRPC clients to connect to linkerd directly, rather than by relying on the http_proxy variable. You can, however, still get the address of linkerd from the http_proxy variable. In pseudo-code this would be:

linkerdAddr = env.get("http_proxy")
grpcClient = new GrpcClient(linkerdAddr)

Hi @Alex, thank you fot the reply. I am sorry, I probably didn’t specify my question clear enough.

Lets say, I have linkerd setup to listen on localhost:4140 to route HTTP communication and on localhost:4340 to route gRPC. If I setup http_proxy=localhost:4140 and configure my gRPC client to connect to linkerd directly (localhost:4340) I will get this result:

HTTP Client -> http://hello -> (proxy) localhost:4140 -> (some real IP)

gRPC Client -> localhost:4340/Greeter/SayHello -> (proxy) localhost:4140 == ERROR

The issue is, that both clients accept value in http_proxy env. variable as their own proxies… I am using newest gRPC client/server from this github project: (version 1.6.1). Do you integrate linkerd gRPC with use of it?

I asked the same question in grpc discussion group but unfortunatelly there is no response :frowning:

Also, I cannot ommit use of http_proxy and set proxy for HTTP clients in code, because some other third-party libraries (like OpenID) does not support it.

Thank you.

Ah, interesting. I don’t have any experience with the csharp grpc library. Does it support the no_proxy environment variable? If so, you should be able to set no_proxy=localhost to skip the http_proxy for requests sent to localhost.

Thank you @Alex, it works.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.