elasticsearch-head连接elasticsearch跨域问题报错Failed to load resource: net::ERR_FAILED

Posted lzh~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch-head连接elasticsearch跨域问题报错Failed to load resource: net::ERR_FAILED相关的知识,希望对你有一定的参考价值。

Failed to load resource: net::ERR_FAILED

Access to XMLHttpRequest at ‘http://192.168.19.18:9200/_all’ from origin ‘http://localhost:9100’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

打开elasticsearch目录下面的config目录里面的elasticsearch.yml文件,在末尾添加

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

重新启动elasticsearch就可以访问了

以上是关于elasticsearch-head连接elasticsearch跨域问题报错Failed to load resource: net::ERR_FAILED的主要内容,如果未能解决你的问题,请参考以下文章

elastic常用工具

windows安装elasticsearch和elasticsearch-head插件

ElasticSearch-Head连接Elasticsearch集群健康值: 未连接问题解决

001-windows下Elasticsearch安装Elasticsearch-header安装

win10 平台 elasticsearch 与 elasticsearch-head 的安装

解决docker创建的elasticsearch-head容器不能连接elasticsearch等问题