diff --git a/lib/utils/proxy/index.ts b/lib/utils/proxy/index.ts index bc04898fc..aa0c5c9a7 100644 --- a/lib/utils/proxy/index.ts +++ b/lib/utils/proxy/index.ts @@ -30,10 +30,14 @@ if (proxyIsPAC) { agent = new PacProxyAgent(`pac+${proxyUri}`); } else if (proxyUri) { if (proxyUri.startsWith('http')) { - agent = new HttpsProxyAgent(proxyUri); + agent = new HttpsProxyAgent(proxyUri, { + headers: { + 'proxy-authorization': config.proxy?.auth ? `Basic ${config.proxy?.auth}` : undefined, + }, + }); dispatcher = new ProxyAgent({ uri: proxyUri, - token: proxyObj?.auth ? `Basic ${proxyObj.auth}` : undefined, + token: config.proxy?.auth ? `Basic ${config.proxy?.auth}` : undefined, requestTls: { rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0', }, diff --git a/lib/utils/request-rewriter/get.ts b/lib/utils/request-rewriter/get.ts index a69e5f1c0..181dd2adb 100644 --- a/lib/utils/request-rewriter/get.ts +++ b/lib/utils/request-rewriter/get.ts @@ -54,9 +54,6 @@ const getWrappedGet: (origin: T) => T = (origin) => if (proxyRegex.test(url.toString()) && url.protocol.startsWith('http') && url.host !== proxy.proxyUrlHandler?.host) { options.agent = proxy.agent; - if (proxy.proxyObj.auth) { - options.headers['Proxy-Authorization'] = `Basic ${proxy.proxyObj.auth}`; - } } }