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.
Any advice would be really appreciated.