# Cannot use ElasticSearch IP Address as Node URI (does not trust server certificate)

**URL:** <https://discuss.elastic.co/t/cannot-use-elasticsearch-ip-address-as-node-uri-does-not-trust-server-certificate/326155>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security, docker\
**Created:** [February 22, 2023, 10:16am UTC](https://discuss.elastic.co/t/cannot-use-elasticsearch-ip-address-as-node-uri-does-not-trust-server-certificate/326155 "2023-02-22T10:16:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lemesios10](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lemesios10](https://discuss.elastic.co/u/lemesios10)\
**Post date:** [February 22, 2023, 10:16am UTC](https://discuss.elastic.co/t/cannot-use-elasticsearch-ip-address-as-node-uri-does-not-trust-server-certificate/326155/1 "2023-02-22T10:16:18Z")

</div>

Hello all. This is my first post here, so please bear with me!

Current setup:  
-Elasticsearch & Kibana hosted on an ubuntu server with docker (therefore the Elastics API URI is something like xxx.xxx.xxx.xxx:9200 for Elasticsearch and xxx:xxx:xxx:xxx:5601 for Kibana)  
-C# application run locally on my machine

I have been trying for the life of me to connect to Elastic's API through my C# Application using Serilog and Serilog.Sinks.Elasticsearch. I am only successful when I create a proxy tunnel to Elasticsearch using ngrok. Using the proxy tunnel (http **s** ://aabbccddee11.ngrok.io for example) I am able to log to Elasticsearch with no problems whatsoever.

If I use the xxx.xxx.xxx.xxx:9200 URI, the container logs the following:

> http client did not trust this server's certificate, closing connection Netty4HttpChannel

Certificate:

 ![ca](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1b083bccf12ce02f7fef3b963cc7834cbf00c342.png)

This is my current configuration in appsettings.json (ngrok):

```
"Serilog": {
   "Using": ["Serilog.Sinks.Elasticsearch"],
   "MinimumLevel": "Information",
   "WriteTo": [
      {
         "Name": "Elasticsearch",
         "Args": {
            "nodeUris": "https://aabbccddee11.ngrok.io",
            "connectionGlobalHeaders": "Authorization=Basic xxx",
            "indexFormat": "someindex-{0:MM.yyyy}",
            "autoRegisterTemplate": true,
            "autoRegisterTemplateVersion": "ESv7",
            "typeName": ""
         }
      }
   ]
}    

```

I know many people have faced the above error and I've looked at many forums online but I haven't found the ultimate solution to my problem.

Your help would be very much appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 22, 2023, 10:16am UTC](https://discuss.elastic.co/t/cannot-use-elasticsearch-ip-address-as-node-uri-does-not-trust-server-certificate/326155/2 "2023-03-22T10:16:47Z")

</div>

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