如何修复此错误?我正在将超集用于 react 应用程序

how to fix this error? I am using superset for react app

提问人:mohanadefm 提问时间:11/4/2023 更新时间:11/5/2023 访问量:60

问:

我正在尝试将超集集成到我的应用程序中,但我不能,因为我遇到了这个错误,这与框架有关,而我在代码中没有使用框架,这是代码:

import { useSelector } from "react-redux";
import { authSelector } from "../../../redux/slices/auth";
import { embedDashboard } from "@superset-ui/embedded-sdk";
import { useEffect } from "react";

function SupersetDashboard({ token }) {
  const { company } = useSelector(authSelector);

  useEffect(() => {
    if (!token) return;
    embedDashboard({
      id: "49271a6d-182b-4761-9e6c-bf2c51bd1be2",
      supersetDomain: "https://dashboard.munjz.com/",
      mountPoint: document.getElementById("superset-iframe"),
      fetchGuestToken: () => token,
      dashboardUiConfig: {
        hideTitle: true,
        hideChartControls: true,
        hideTab: true,
      },
      rls: [{ clause: `company_id = ${company.id}` }],
    });
  }, []);

  return <div id="superset-iframe"></div>;
}

export default SupersetDashboard;

这是错误:

Refused to display 'https://dashboard.munjz.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

这是为了在我的网页中显示数据

JavaScript 反应JS DOM apache-superset

评论


答:

0赞 Onur Gelmez 11/4/2023 #1

您无法访问该站点,因为服务器设置为仅从同一源(域)访问。如果可以管理“https://dashboard.munjz.com/”,请删除“X-Frame-Option”标头或添加值。ALLOW-FROM

评论

0赞 mohanadefm 11/4/2023
它是否与域相关,我的意思是我应该向域添加额外的单词才能工作吗?因为我没有在网站上找到类似的坐姿。
0赞 Onur Gelmez 11/4/2023
不是域,“dashboard.munjz.com”应用程序已设置为阻止来自其他来源的传入请求,因此这就是它给出此错误的原因。看看 X-Frame-Option 和 cors,这样你就可以有一个解决它的想法。如果您无权更新“dashboard.munjz.com”,则无法访问此域名。