CORS not getting enabled in ElasticSearch dockerfile


By pulling latest image from I tried enabling CORS.

This is my dockerfile -

ADD elasticsearch.yml /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch config/elasticsearch.yml
USER elasticsearch

This is my elasticsearch.yml -
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" false
# Uncomment the following lines for a production cluster deployment
# #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.