diff --git a/src/common/system-ca.ts b/src/common/system-ca.ts index dfead212ae..904ec01b97 100644 --- a/src/common/system-ca.ts +++ b/src/common/system-ca.ts @@ -76,10 +76,13 @@ export function getWinRootCA(): Promise { * Add (or merge) CAs to https.globalAgent.options.ca */ export function injectCAs(CAs: string[]) { - const oldCAs = [https.globalAgent.options.ca].flat(); - const injectedCAs = new Set([...oldCAs, ...CAs]); - - https.globalAgent.options.ca = [...injectedCAs]; + for (const cert of CAs) { + if (Array.isArray(https.globalAgent.options.ca) && !https.globalAgent.options.ca.includes(cert)) { + https.globalAgent.options.ca.push(cert); + } else { + https.globalAgent.options.ca = [cert]; + } + } } /**