wreck
wreck copied to clipboard
Unable to add https_proxy in wreck client
Support plan
- is this issue currently blocking your project? (yes/no):
- is this issue affecting a production system? (yes/no):
Context
- node version: 10.24.1
- module version with issue: 15.0.2
- last module version without issue:
- environment (e.g. node, browser, native): node
- used with (e.g. hapi application, another framework, standalone, ...): Opensearch dashboard security plugin
- any other relevant information:
- module name hapi/wreck client
What are you trying to achieve or the steps to reproduce?
My application is deployed in virtual private network.So now i want to use it externally and it required to call a third party external internet URL.So I want to pass a proxy server so wreck client can connect that url .
I have used kubernetes http_proxy environment variables but wreck client not respect it.
private createWreckClient(): typeof wreck {
const wreckHttpsOption: WreckHttpsOptions = {};
if (this.config.openid?.root_ca) {
wreckHttpsOption.ca = [fs.readFileSync(this.config.openid.root_ca)];
}
if (this.config.openid?.verify_hostnames === false) {
this.logger.debug(`openId auth 'verify_hostnames' option is off.`);
wreckHttpsOption.checkServerIdentity = (host: string, cert: PeerCertificate) => {
return undefined;
};
}
if (Object.keys(wreckHttpsOption).length > 0) {
return wreck.defaults({
agents: {
http: new HTTP.Agent(),
https: new HTTPS.Agent(wreckHttpsOption),
httpsAllowUnauthorized: new HTTPS.Agent({
rejectUnauthorized: false,
}),
},
});
} else {
return wreck;
}
}
What was the result you got?
{"type":"log","@timestamp":"2023-05-15T11:03:56Z","tags":["error","plugins","securityDashboards"],"pid":1,"message":"{ Error: connect ETIMEDOUT 240:f6e4:e6b2:4838:0ff0:158b:3654:8065:443\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)\n errno: 'ETIMEDOUT',\n code: 'ETIMEDOUT',\n syscall: 'connect',\n address: '240:f6e4:e6b2:4838:0ff0:158b:3654:8065',\n port: 443,\n trace:\n [ { method: 'GET',\n url:\n 'https://somedns/.well-known/openid-configuration' } ],\n isBoom: true,\n isServer: true,\n data: null,\n output:\n { statusCode: 502,\n payload:\n { message:\n 'Client request error: connect ETIMEDOUT 240:f6e4:e6b2:4838:0ff0:158b:3654:8065:443',\n statusCode: 502,\n error: 'Bad Gateway' },\n headers: {} } }"} {"type":"log","@timestamp":"2023-05-15T11:03:56Z","tags":["warning","environment"],"pid":1,"message":"Detected an unhandled Promise rejection.\nError: Failed when trying to obtain the endpoints from your IdP"}
What result did you expect?
External url should be accessible with proxy