# CORS not getting enabled in ElasticSearch dockerfile

**URL:** <https://discuss.elastic.co/t/cors-not-getting-enabled-in-elasticsearch-dockerfile/91622>\
**Category:** Elasticsearch\
**Created:** [July 3, 2017, 11:45am UTC](https://discuss.elastic.co/t/cors-not-getting-enabled-in-elasticsearch-dockerfile/91622 "2017-07-03T11:45:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yugansh\_Aggarwal](https://avatars.discourse-cdn.com/v4/letter/y/9fc29f/32.png) [@Yugansh\_Aggarwal](https://discuss.elastic.co/u/Yugansh_Aggarwal)\
**Post date:** [July 3, 2017, 11:45am UTC](https://discuss.elastic.co/t/cors-not-getting-enabled-in-elasticsearch-dockerfile/91622/1 "2017-07-03T11:45:37Z")

</div>

Hi

By pulling latest image from [https://hub.docker.com/\_/elasticsearch/](https://hub.docker.com/_/elasticsearch/) I tried enabling CORS.

This is my dockerfile -

```auto
FROM docker.elastic.co/elasticsearch/elasticsearch:5.4.1
ADD elasticsearch.yml /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch config/elasticsearch.yml
USER elasticsearch

```

This is my elasticsearch.yml -

```auto
http.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"
xpack.security.enabled: false
# Uncomment the following lines for a production cluster deployment
# #transport.host: 0.0.0.0
# #discovery.zen.minimum_master_nodes: 1

```

I am not sure why CORS is still not enabled , need help.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 7, 2017, 6:49am UTC](https://discuss.elastic.co/t/cors-not-getting-enabled-in-elasticsearch-dockerfile/91622/2 "2017-07-07T06:49:09Z")

</div>

_Please use the code button_ (`</>`) _when pasting in configuration files. That prevents the special characters in the file from being treated as markdown formatting_.

What makes you think that CORS isn't enabled?  
You've not shown anything to indicate one way or another whether CORS is working.

If you're looking for CORS headers coming back from ES, then check that you are actually initiating a CORS response - see this topic [Config cors setting not working?](https://discuss.elastic.co/t/config-cors-setting-not-working/90189/2)

---

<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:** [August 4, 2017, 6:49am UTC](https://discuss.elastic.co/t/cors-not-getting-enabled-in-elasticsearch-dockerfile/91622/3 "2017-08-04T06:49:17Z")

</div>

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