We have two docker container: one is running our service image and one is running the Kusto Emulator image.
Our service wants to ingest messages to Kusto Emulator. For that, we created an IngestClient to connect to Kusto Emulator. Since IngestClient is inside a container, we use the hostname of Kusto Emulator container ("kusto-emulator") instead of localhost to make our service container communicate with it.
The connection between docker containers uses http://.
Current Problem: since the communication is between two docker containers the hostname is neither localhost nor https://, as referred previously, it fails in the following step as a unsecure connection:
HttpPostUtils.class
private static @NotNull URI parseUriFromUrlString(String url) throws DataClientException {
try {
URL cleanUrl = new URL(url);
---> if (!"https".equalsIgnoreCase(cleanUrl.getProtocol()) && !url.toLowerCase().startsWith("http://localhost")) {
throw new DataClientException(url, "Cannot forward security token to a remote service over insecure channel (http://)");
} else {
return new URI(cleanUrl.getProtocol(), cleanUrl.getUserInfo(), cleanUrl.getHost(), cleanUrl.getPort(), cleanUrl.getPath(), cleanUrl.getQuery(), cleanUrl.getRef());
}
} catch (MalformedURLException | URISyntaxException var2) {
Exception e = var2;
throw new DataClientException(url, "Error parsing target URL in post request:" + ((Exception)e).getMessage(), e);
}
}
public static String post(CloseableHttpClient httpClient, String urlStr, AbstractHttpEntity requestEntity, long timeoutMs, Map<String, String> headers) throws DataServiceException, DataClientException {
---> URI url = parseUriFromUrlString(urlStr);
[...]
}
Hello,
Context:
We have two docker container: one is running our service image and one is running the Kusto Emulator image. Our service wants to ingest messages to Kusto Emulator. For that, we created an IngestClient to connect to Kusto Emulator. Since IngestClient is inside a container, we use the hostname of Kusto Emulator container ("kusto-emulator") instead of localhost to make our service container communicate with it. The connection between docker containers uses http://.
Current Problem: since the communication is between two docker containers the hostname is neither localhost nor https://, as referred previously, it fails in the following step as a unsecure connection:
Thank you!