近期有个需求是,用户能一键导出所查询内容的所有数据(discover页面显示的只是部分,因此只好二次开发),我们自己搭了个后端,前端只是传递参数而已,但是会存在跨域的报错,同样的$http请求代码,放出kibana单独测试是没有问题的,代码及报错如下
Failed to load http://192.:8080/elastic-web/e ... tion: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://10.1.106:5601' is therefore not allowed access.
1 个回复
xinfanwang
赞同来自:
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"