Elastic Search添加X-Pack插件后,head无法访问的问题

版本5.4.1

最近调试ElasticSearch集群时,为了监控方便部署了X-Pack,然后因为验证的问题,head无法正确连接集群了。

查了一些中文资料给出的方法是在elasticsearch.yml中添加如下三行

(1)

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

然后用(2)

http://localhost:9100/?auth_user=elastic&auth_password=changeme

的方式访问head,发现并不能解决问题,依然还是无法连接。

研究后发现,需要将上面的elasticsearch.yml中的三行变更为

(3)

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type 

 此后可以正确通过(2)的访问方式访问head,成功连接,问题解决

posted @ 2018-01-04 18:21  Alex因明  阅读(272)  评论(0编辑  收藏  举报