# Publishing a hostname instead of an ip address

**URL:** <https://discuss.elastic.co/t/publishing-a-hostname-instead-of-an-ip-address/70954>\
**Category:** Elasticsearch\
**Created:** [January 9, 2017, 3:07pm UTC](https://discuss.elastic.co/t/publishing-a-hostname-instead-of-an-ip-address/70954 "2017-01-09T15:07:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mortenbock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenbock/32/13062_2.png) [@mortenbock](https://discuss.elastic.co/u/mortenbock)\
**Post date:** [January 9, 2017, 3:07pm UTC](https://discuss.elastic.co/t/publishing-a-hostname-instead-of-an-ip-address/70954/1 "2017-01-09T15:07:35Z")

</div>

I'm trying to set up my v5 cluster to publish a host name instead of an IP address as it's endpoint.

The problem is, that even if I type a hostname in the elasticsearch.yml file, then it will resolve that hostname to an IP, and use that as the publish addresse.

The scenario is this:

The hostname I want all clients to use is es.example.local. The hostname resolves to different IP's depending on the clients location:

ES-server:  
IP: 10.10.20.150  
es.example.local resolves to 127.0.0.1

Proxy server:  
IP: 10.250.9.150  
Forwards 10.250.9.150 to 10.10.20.150

Client A:  
es.example.local resolves to 10.250.9.150

Client B:  
es.example.local resolves to 10.10.20.150

Now, when using the NEST client in my project, Client A and B will start by requesting

[http://es.example.local:9200/\_nodes/http,settings?flat\_settings&timeout=2s&pretty=true](http://es.example.local:9200/_nodes/http,settings?flat_settings&timeout=2s&pretty=true)

After that, both clients will start using 10.10.20.150 for their http requests.

This works well for Client B, but Client A cannot reach 10.10.20.150.

If I set http.publish\_host to es.example.local, then both clients will start trying to connect to 127.0.0.1, because that is what this hostname resolves to on the ES server.

Is there any way for me to publish a hostname to the clients, that they can use, instead of an IP address? That way all the clients can resolve the hostname to the IP they need, and the proxy can then forward the request to the actual ES server.

---

<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:** [February 6, 2017, 3:07pm UTC](https://discuss.elastic.co/t/publishing-a-hostname-instead-of-an-ip-address/70954/2 "2017-02-06T15:07:37Z")

</div>

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