CORS not getting enabled in ElasticSearch dockerfile

Hi

By pulling latest image from https://hub.docker.com/_/elasticsearch/ I tried enabling CORS.

This is my dockerfile -

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 -

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.

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?

1 Like

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