At first, I tried to access Elasticsearch via a React Application. I was successful at first. But when I try the same app from another machine, Application doesn't show any data.
I am getting this following error at the console,
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://x.x.x.x:9200/_cat/indices?format=json. (Reason: CORS request did not succeed).
Following are the details of relevant configurations,
elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: '*'
http.cors.allow-methods: OPTIONS, HEAD, GET, POST
http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type,Content-Length, Authorization
http.cors.allow-credentials: true
Following is the curl
output,
curl -k -i -X OPTIONS -H "User-Agent: Mozilla" -H "Origin: http://loggie.netlify.com" -u elastic https://x.x.x.x:9200/_data
Enter host password for user 'elastic':
HTTP/1.1 200 OK
Allow: GET,DELETE,PUT,HEAD
content-type: text/plain; charset=UTF-8
content-length: 0
access-control-allow-origin: *
access-control-allow-credentials: true
Can't find where is the problem and where to start the troubleshooting.