# ElasticSearch.js and Access-Control-Allow-Origin': 'true'

**URL:** <https://discuss.elastic.co/t/elasticsearch-js-and-access-control-allow-origin-true/30072>\
**Category:** Elasticsearch\
**Created:** [September 26, 2015, 8:22pm UTC](https://discuss.elastic.co/t/elasticsearch-js-and-access-control-allow-origin-true/30072 "2015-09-26T20:22:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sureshadapa](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@sureshadapa](https://discuss.elastic.co/u/sureshadapa)\
**Post date:** [September 26, 2015, 8:22pm UTC](https://discuss.elastic.co/t/elasticsearch-js-and-access-control-allow-origin-true/30072/1 "2015-09-26T20:22:55Z")

</div>

Hello,

I am trying to develop web application and charts using D3.js,require.js and es.js  
In this process my ES is running at IP1:port and App server at IP2:port

In my App server i have deployed code and set header to 'Access-Control-Allow-Origin': 'true'  
as below which seems to be not working.

var client = elasticsearch.Client({  
hosts: [{  
host: 'localhost',  
port: 9200,  
headers: {  
'Access-Control-Allow-Origin': 'true'  
}  
}]  
});

In Chrome i have installed CORS plugin that http request renders nice pie chat.  
But when i make the same request in IE, it does not work.

So,I am wondering how can my application work on all devices,browsers? If anyone has done let me know. May be i need to deep dive into kibana source code and figure out how it is done.

---

<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:** [July 5, 2017, 11:47pm UTC](https://discuss.elastic.co/t/elasticsearch-js-and-access-control-allow-origin-true/30072/2 "2017-07-05T23:47:56Z")

</div>


