Hostname-dependent service in a service mesh

Hello,

Im facing an issue with hostname-dependent service in our service mesh. Im using nomad to deploy a service ,A" within a service mesh (with sidecar proxy), which makes a connection to a service ,B" which is located outside the service mesh. To make that work I’ve registered service B as external service in consul, then I’ve deployed a terminating gateway with Nomad, which makes a connection to outside the service mesh. My service A has an env variable, where url of a service B is passed.

When we deploy service A with env B_URL = “localhost:port”, sidecar proxy will send all requests made from service A to a terminating gateway, which will send those to a service B. Answer from service B is successfully received.

Unfortunately, service A uses external library with a function, where variable B_URL is compared with received answer. Comparison of B_URL=localhost:port (sidecar proxy) with received answer of service.B.hostname.com throws us an error.

fatal error: oidc: issuer did not match the issuer returned by provider, expected “http://127.0.0.1:80/realms/realm” got “https://service.B.hostname.com/realms/realm

Any advice would be really appreciated.

@Luke_b, the next release of Nomad will support Consul’s transparent proxy feature. This will allow the external application to be reached using its normal hostname instead of localhost:<port>.

See this blog post for more info on the transparent proxy feature.