elasticsearch,nginx,kibana,Javascript,elasticsearch,Nginx,Kibana" /> elasticsearch,nginx,kibana,Javascript,elasticsearch,Nginx,Kibana" />

Javascript 无法从获取api加载kibana仪表板

Javascript 无法从获取api加载kibana仪表板,javascript,elasticsearch,nginx,kibana,Javascript,elasticsearch,Nginx,Kibana,我已经用nginx反向代理配置了kibana,现在我想要的是在iframe中显示kibana报告 问题是我的kibana仪表板受nginx basic auth保护(加载时要求输入用户名和密码) 我通过fetchapi传递了安全性,并在iframe see代码中加载了传入响应 <html> <head> </head> <body> <div id="content"> <div style="height:800p

我已经用nginx反向代理配置了kibana,现在我想要的是在iframe中显示kibana报告

问题是我的kibana仪表板受nginx basic auth保护(加载时要求输入用户名和密码)

我通过fetchapi传递了安全性,并在iframe see代码中加载了传入响应

<html>
<head>
</head>
<body>



<div id="content">
    <div style="height:800px;">
        <iframe id="output-frame-id" src="" scrolling="no"
            frameborder="0" height="100%" width="100%" ></iframe>
    </div>
</div>


<script>

let URL="http://localhost:5601"
async function make()
{
    const response = await fetch(URL, {
        method: 'get',
        headers: {
          'Authorization': 'Basic ' + btoa("username" + ":" + "password"),
          'Content-Type': 'application/json',

        },

      });
      const posts = await response.blob();

      console.log(posts);
var myURL = window.URL || window.webkitURL

var data_url=myURL.createObjectURL(posts)

      document.querySelector('#output-frame-id').src = data_url;


}
make();

</script>



</body>


</html>

让URL=”http://localhost:5601"
异步函数make()
{
const response=等待获取(URL{
方法:“get”,
标题:{
“授权”:“基本”+btoa(“用户名”+:“+”密码”),
“内容类型”:“应用程序/json”,
},
});
const posts=wait response.blob();
控制台日志(posts);
var myURL=window.URL | | window.webkitURL
var data_url=myURL.createObjectURL(posts)
document.querySelector(“#输出帧id”).src=data\u url;
}
make();

我能够获得数据,但它只显示kibana的加载页面。Rest仪表板未加载。你知道如何解决这个问题吗?

为什么要将Kibana放入Iframe?为什么不直接使用它呢?kibana url将具有动态查询参数,用于根据传递的数据生成仪表板。fyi
Access Control Allow Origin
标题应在服务器端设置,而不是在获取API中设置。感谢提供信息,其已在服务器中设置:)