0
点赞
收藏
分享

微信扫一扫

解决问题docker容器启动es-head No ‘Access-Control-Allow-Origin‘ header is present on the requested resource

mafa1993 2022-04-14 阅读 99

es-head连接错误问题

主要问题:跨域

No 'Access-Control-Allow-Origin' header is present on the requested resource

解决办法:

1.进入elasticsearch容器内

docker exec -it es /bin/bash

2.到config文件夹下修改elasticsearch.yml

vi elasticsearch.yml 

3.添加

http.cors.enabled: true
http.cors.allow-origin: "*"
#设置ip全部通过

cluster.name:自定义集群名称;
network.host:当前es节点绑定的ip地址;
http.cors.enabled:是否支持跨域,默认为false;
http.cors.allow-origin:当设置允许跨域,默认为*,表示支持所有域名,如果我们只是允许某些网站能访问,那么可以使用正则表达式。


4.重启docker-compose(切记不要down,否则得重新修改)

docker-compose restart 

5.重新打开地址,即可连接连接Elasticsearch

 

举报

相关推荐

“Access-Control-Allow-Origin“跨域问题

0 条评论