fix: proxy auth
This commit is contained in:
@@ -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',
|
||||
},
|
||||
|
||||
@@ -54,9 +54,6 @@ const getWrappedGet: <T extends Get>(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}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user