From 46e95317f68469cd2247ff42d5ba42c6de65ca3f Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Sat, 17 Jan 2026 07:07:56 +0500 Subject: [PATCH] fix(proxy): add connection limits and IPv4 support to undici agents --- server/utils/customProxyAgent.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/utils/customProxyAgent.ts b/server/utils/customProxyAgent.ts index 321aa9048..11f56980d 100644 --- a/server/utils/customProxyAgent.ts +++ b/server/utils/customProxyAgent.ts @@ -14,7 +14,11 @@ export default async function createCustomProxyAgent( proxySettings: ProxySettings, forceIpv4First?: boolean ) { - const defaultAgent = new Agent({ keepAliveTimeout: 5000 }); + const defaultAgent = new Agent({ + keepAliveTimeout: 5000, + connections: 50, + connect: forceIpv4First ? { family: 4 } : undefined, + }); const skipUrl = (url: string | URL) => { const hostname = @@ -68,6 +72,8 @@ export default async function createCustomProxyAgent( uri: proxyUrl, token, keepAliveTimeout: 5000, + connections: 50, + connect: forceIpv4First ? { family: 4 } : undefined, }); setGlobalDispatcher(proxyAgent.compose(noProxyInterceptor));