Skip to content

Commit

Permalink
feat: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl committed Nov 24, 2024
1 parent b829cb4 commit a5d9b2e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
30 changes: 19 additions & 11 deletions keep-ui/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,26 @@ const proxyUrl =

import { ProxyAgent, fetch as undici } from "undici";
function proxy(...args: Parameters<typeof fetch>): ReturnType<typeof fetch> {
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
Expand Down
7 changes: 1 addition & 6 deletions keep-ui/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a5d9b2e

Please sign in to comment.