Use `rejectUnauthorized` without proxy URL
In v5 I am creating a proxy agent for some use-cases where I only needed to set the rejectUnauthorized flag:
new HttpsProxyAgent({ rejectUnauthorized: false })
But in v7, I don't see how to do the same, since the following throws.
new HttpsProxyAgent('', { rejectUnauthorized: false })
How can this be accomplished in v7?
Same +1
I am having the issue with a url too
any solution?
Anyone have any idea on this one? Would love to be able to move off of v5 if possible.
Stumbled on your issue and it baffled me. Looking at the code, your v5 example should work, as it should hot the socket.connect, which defines that port is a required option. V5 had very naive test to ensure the host and port are defined https://github.com/TooTallNate/proxy-agents/blob/5.0.1/src/agent.ts#L38-L42, which of course doesn't trigger for your example.
Anyhow, assuming you are using proxy from your local host, then maybe something like new HttpsProxyAgent('http://localhost', { rejectUnauthorized: false }) would do the trick. Of course, this has little effect as the the tunnel is within your own machine.
If the proxy information is supposed to come from the environment, then I guess you would need https://www.npmjs.com/package/proxy-from-env , which is used by the proxy-agent in this repo: https://github.com/TooTallNate/proxy-agents/blob/main/packages/proxy-agent/src/index.ts#L100.
Additionally, the rejectUnauthorized only applies to the proxy connection (HTTP in above) and not for the actual TLS connection to the server. See #235 for solution to pass options to the actual server connection.
I hope this helps you to move forward.