diff --git a/agent/main/interfaces/IProxyConnectionOptions.ts b/agent/main/interfaces/IProxyConnectionOptions.ts index 2a587edd9..5c938f158 100644 --- a/agent/main/interfaces/IProxyConnectionOptions.ts +++ b/agent/main/interfaces/IProxyConnectionOptions.ts @@ -1,4 +1,5 @@ export default interface IProxyConnectionOptions { address: string; + username?: string; password?: string; } diff --git a/agent/main/lib/Agent.ts b/agent/main/lib/Agent.ts index 3218e5a7c..aea163375 100644 --- a/agent/main/lib/Agent.ts +++ b/agent/main/lib/Agent.ts @@ -54,10 +54,9 @@ export default class Agent extends TypedEventEmitter<{ close: void }> { private get proxyConnectionInfo(): IProxyConnectionOptions { if (!this.enableMitm) { - if (this.emulationProfile.upstreamProxyUrl) { - return { address: this.emulationProfile.upstreamProxyUrl }; - } - return null; + if (!this.emulationProfile.upstreamProxyUrl) return null; + const url = new URL(this.emulationProfile.upstreamProxyUrl); + return { address: url.origin, username: url.username, password: url.password }; } if (this.isolatedMitm) { // don't use password for an isolated mitm proxy