@@ -34,7 +34,7 @@ import { OpenIDConnectAuth } from './oidc_auth.js';
3434import WebSocket from 'isomorphic-ws' ;
3535import child_process from 'node:child_process' ;
3636import { SocksProxyAgent } from 'socks-proxy-agent' ;
37- import { HttpProxyAgent , HttpsProxyAgent } from 'hpagent' ;
37+ import { HttpProxyAgent , HttpProxyAgentOptions , HttpsProxyAgent , HttpsProxyAgentOptions } from 'hpagent' ;
3838
3939const SERVICEACCOUNT_ROOT : string = '/var/run/secrets/kubernetes.io/serviceaccount' ;
4040const SERVICEACCOUNT_CA_PATH : string = SERVICEACCOUNT_ROOT + '/ca.crt' ;
@@ -254,17 +254,16 @@ export class KubeConfig implements SecurityAuthentication {
254254
255255 if ( cluster && cluster . proxyUrl ) {
256256 if ( cluster . proxyUrl . startsWith ( 'socks' ) ) {
257+ agentOptions . rejectUnauthorized = false ;
257258 agent = new SocksProxyAgent ( cluster . proxyUrl , agentOptions ) ;
258- } else if ( cluster . server . startsWith ( 'http' ) ) {
259- agent = new HttpProxyAgent ( {
260- proxy : cluster . proxyUrl ,
261- ...agentOptions ,
262- } ) ;
263259 } else if ( cluster . server . startsWith ( 'https' ) ) {
264- agent = new HttpsProxyAgent ( {
265- proxy : cluster . proxyUrl ,
266- ...agentOptions ,
267- } ) ;
260+ const httpsProxyAgentOptions : HttpsProxyAgentOptions = agentOptions as HttpsProxyAgentOptions ;
261+ httpsProxyAgentOptions . proxy = cluster . proxyUrl ;
262+ agent = new HttpsProxyAgent ( httpsProxyAgentOptions ) ;
263+ } else if ( cluster . server . startsWith ( 'http' ) ) {
264+ const httpProxyAgentOptions : HttpProxyAgentOptions = agentOptions as HttpProxyAgentOptions ;
265+ httpProxyAgentOptions . proxy = cluster . proxyUrl ;
266+ agent = new HttpProxyAgent ( httpProxyAgentOptions ) ;
268267 } else {
269268 throw new Error ( 'Unsupported proxy type' ) ;
270269 }
0 commit comments