XMLHttpRequest无法加载http:// localhost:9200 /。 elasticsearch

时间:2015-06-11 05:57:54

标签: javascript angularjs elasticsearch

我在我的Windows机器上运行弹性搜索,我可以curl -XGET "http://localhost:9200/movies/_search"并获得一大堆对象。

当我尝试用角度请求var client = elasticsearch({ host: 'localhost:9200' });时,我会得到以下内容。

XMLHttpRequest cannot load http://localhost:9200/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

我在elasticsearch.yml内添加了

http.cors.allow-origin: "*"
http.cors.enabled: true

并尝试

http.cors.allow-origin: "/localhost(:[0-9]+)?/"

0 个答案:

没有答案