We're experimenting with an RPC service (linkerd) that acts as a glue between our microservices – reading off their locations from a local Consul cluster etc. Now Linkerd expects to see the Host
header on an incoming request to figure out which service to hit.
In our topology, we have nginx running as the edge which is then supposed to proxy to Linkerd and set the Host header depending on the path.
So a simple configuration we're testing looks like this;
location /api/v1/services/service-x {
proxy_set_header Host service-x;
proxy_pass http://linkerd:4140;
}
Which is nothing fancy. It matches the paths that are the paths of service-x
, then attempts to proxy_pass those requests to linkerd with the name of the service set in the header Linkerd is supposed to receive.
What we're seeing is that the Host header is never set. The service is reachable via Linkerd if I curl -H "Host: service-x" linkerd:4140/some/x/path
.
How are we supposed to set headers for upstreams with nginx? Or am I doing something stupid?
Thanks!