-
-
Metaset BI
+
-
- {/* Container do iframe */}
-
- {isLoading && (
-
-
-
- Carregando Metaset...
-
-
- )}
-
- {hasError ? (
-
-
-
-
- Não foi possível carregar o Metaset. O site pode não permitir embed em iframe.
-
-
-
-
- ) : (
-
+ )}
+
);
}
diff --git a/server/bi/metaset-proxy.ts b/server/bi/metaset-proxy.ts
new file mode 100644
index 0000000..c6f1226
--- /dev/null
+++ b/server/bi/metaset-proxy.ts
@@ -0,0 +1,39 @@
+import { Express, Response } from "express";
+import { createProxyMiddleware } from "http-proxy-middleware";
+
+const METASET_HOST = process.env.METASET_HOST || "metaset";
+const METASET_PORT = parseInt(process.env.METASET_PORT || "8100", 10);
+const METASET_TIMEOUT = 60000;
+
+export function setupMetasetProxy(app: Express): void {
+ const target = `http://${METASET_HOST}:${METASET_PORT}`;
+
+ const metasetProxy = createProxyMiddleware({
+ target,
+ changeOrigin: true,
+ timeout: METASET_TIMEOUT,
+ proxyTimeout: METASET_TIMEOUT,
+ pathRewrite: { "^/metaset": "" },
+ on: {
+ error: (err, _req, res) => {
+ console.error("[Metaset Proxy] Error:", err.message);
+ if (res && typeof (res as Response).status === "function") {
+ (res as Response).status(502).json({
+ error: "Metaset indisponível",
+ message: "O Metaset BI está iniciando. Tente novamente em alguns segundos.",
+ target,
+ });
+ }
+ },
+ proxyRes: (proxyRes) => {
+ const location = proxyRes.headers["location"];
+ if (location && typeof location === "string" && location.startsWith("/")) {
+ proxyRes.headers["location"] = `/metaset${location}`;
+ }
+ },
+ },
+ });
+
+ app.use("/metaset", metasetProxy);
+ console.log(`[Metaset Proxy] Configurado -> /metaset/* => ${target}`);
+}
diff --git a/server/routes.ts b/server/routes.ts
index 7139198..f20a837 100644
--- a/server/routes.ts
+++ b/server/routes.ts
@@ -51,6 +51,7 @@ import governanceRoutes from "./governance/routes";
import { setupPlusProxy } from "./plus/proxy";
import { setupSupersetProxy } from "./superset/proxy";
import { registerSupersetRoutes } from "./superset/routes";
+import { setupMetasetProxy } from "./bi/metaset-proxy";
import { setupErpNextProxy } from "./erpnext/proxy";
import { importErpNextRulesForTenant } from "./soe/erpnext-rule-importer";
import { registerEngineRoomRoutes } from "./engine-room/routes";
@@ -89,6 +90,9 @@ export async function registerRoutes(
setupSupersetProxy(app);
registerSupersetRoutes(app);
+ // MetaSet - BI alternativo (porta 8100)
+ setupMetasetProxy(app);
+
// ERPNext container proxy (ativo apenas em DOCKER_MODE ou ERPNEXT_PROXY_ENABLED=true)
setupErpNextProxy(app);