From 0c8c759f8abbeaba97ce2390574f975252151a1a Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:42:15 -0700 Subject: [PATCH] Enable `autoSelectFamily` for http(s) requests (#2214) --- src/utils/proxy/http.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/utils/proxy/http.js b/src/utils/proxy/http.js index 134b81fd3..1755dd936 100644 --- a/src/utils/proxy/http.js +++ b/src/utils/proxy/http.js @@ -85,16 +85,20 @@ export async function httpProxy(url, params = {}) { let request = null; if (constructedUrl.protocol === "https:") { - const httpsAgent = new https.Agent({ - rejectUnauthorized: false, - }); - request = httpsRequest(constructedUrl, { - agent: httpsAgent, + agent: new https.Agent({ + rejectUnauthorized: false, + autoSelectFamily: true, + }), ...params, }); } else { - request = httpRequest(constructedUrl, params); + request = httpRequest(constructedUrl, { + agent: new http.Agent({ + autoSelectFamily: true, + }), + ...params, + }); } try {