From a5d9b2e58d2436abf12db1fdfbed2dad8cb80e46 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 24 Nov 2024 14:18:37 +0200 Subject: [PATCH] feat: wip --- keep-ui/auth.ts | 30 +++++++++++++++++++----------- keep-ui/next.config.js | 7 +------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/keep-ui/auth.ts b/keep-ui/auth.ts index 92cd08dcd..8e05e97ab 100644 --- a/keep-ui/auth.ts +++ b/keep-ui/auth.ts @@ -44,18 +44,26 @@ const proxyUrl = import { ProxyAgent, fetch as undici } from "undici"; function proxy(...args: Parameters): ReturnType { - const dispatcher = new ProxyAgent({ - uri: proxyUrl!, - // Force DNS resolution through the proxy - // Use requestTls to control connection behavior - requestTls: { - rejectUnauthorized: true, - // This will make the DNS resolution happen on the proxy side - servername: new URL(args[0].toString()).hostname, - }, - }); + console.log( + "Proxy called for URL:", + args[0] instanceof Request ? args[0].url : args[0] + ); + const dispatcher = new ProxyAgent(proxyUrl!); + + if (args[0] instanceof Request) { + const request = args[0]; + // @ts-expect-error `undici` has a `duplex` option + return undici(request.url, { + ...args[1], + method: request.method, + headers: request.headers as HeadersInit, + body: request.body, + dispatcher, + }); + } + // @ts-expect-error `undici` has a `duplex` option - return undici(args[0], { ...args[1], dispatcher }); + return undici(args[0], { ...(args[1] || {}), dispatcher }); } // Create Azure AD provider configuration diff --git a/keep-ui/next.config.js b/keep-ui/next.config.js index 47e955ce0..6d4ace32f 100644 --- a/keep-ui/next.config.js +++ b/keep-ui/next.config.js @@ -52,12 +52,7 @@ const nextConfig = { ], }, compiler: { - removeConsole: - process.env.NODE_ENV === "production" - ? { - exclude: ["error"], - } - : process.env.REMOVE_CONSOLE === "true", + removeConsole: false, }, output: "standalone", productionBrowserSourceMaps: