-
Notifications
You must be signed in to change notification settings - Fork 558
Closed
Description
So yeah I spent like 2 hours deep dive debugging into this only to discover a bug.
Lines 527 to 551 in 3283cb1
private createAgent( | |
cluster: Cluster | null, | |
agentOptions: https.AgentOptions, | |
): https.Agent | SocksProxyAgent | HttpProxyAgent | HttpsProxyAgent { | |
let agent: https.Agent | SocksProxyAgent | HttpProxyAgent | HttpsProxyAgent; | |
if (cluster && cluster.proxyUrl) { | |
if (cluster.proxyUrl.startsWith('socks')) { | |
agent = new SocksProxyAgent(cluster.proxyUrl, agentOptions); | |
} else if (cluster.server.startsWith('https')) { | |
const httpsProxyAgentOptions: HttpsProxyAgentOptions = agentOptions as HttpsProxyAgentOptions; | |
httpsProxyAgentOptions.proxy = cluster.proxyUrl; | |
agent = new HttpsProxyAgent(httpsProxyAgentOptions); | |
} else if (cluster.server.startsWith('http')) { | |
const httpProxyAgentOptions: HttpProxyAgentOptions = agentOptions as HttpProxyAgentOptions; | |
httpProxyAgentOptions.proxy = cluster.proxyUrl; | |
agent = new HttpProxyAgent(httpProxyAgentOptions); | |
} else { | |
throw new Error('Unsupported proxy type'); | |
} | |
} else { | |
agent = new https.Agent(agentOptions); | |
} | |
return agent; | |
} |
more specifically
Lines 533 to 536 in 3283cb1
if (cluster && cluster.proxyUrl) { | |
if (cluster.proxyUrl.startsWith('socks')) { | |
agent = new SocksProxyAgent(cluster.proxyUrl, agentOptions); | |
} else if (cluster.server.startsWith('https')) { |
if no proxyUrl
is set, then the default will be an HTTPS agent, which does not work with kubectl proxy
environments.
Metadata
Metadata
Assignees
Labels
No labels