Getting error of 'Access-Control-Allow-Origin' header is present on the requested resource'
Asked
Active
Viewed 63 times
1 Answers
0
You need to enable cors in your elasticsearch.yml
configuration:
http.cors.enabled: true
Also you need to allow some origin because none is allowed by default:
http.cors.allow-origin: "*"
Note that allowing all origins (i.e. "*"
) is a security risk, so you can also be more restrictive on that
http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/

Val
- 207,596
- 13
- 358
- 360
-
I have not made any such config changes in my stage environment but still able to access, but not for prod. The only difference is ES 2.1 on stage and ES 2.4 on prod and i don't see any such breaking changes in new versions. – naw Sep 26 '16 at 17:37
-
Yes, that was due to a [change](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-2.3.html#_cors_support_broken_in_2_3_0_and_2_3_1) they made in ES 2.3. – Val Sep 29 '16 at 18:11