HTTP Proxy with undici and HTTPDataSource
Hi,
I'm using HTTPDataSource that uses undici. I'm trying to make it work through a proxy.
I've tried to use:
const proxyAgent = new ProxyAgent({ uri: '0.0.0.0:3128', protocol: 'http', } ); setGlobalDispatcher(proxyAgent);
The problem is, it does not seem to work. Could You provide any suggestions?
I'm using HTTPDataSource the recommended way based on the manual provided here: https://github.com/StarpTech/apollo-datasource-http
cc @starpttech - I'm unsure how to proceed as it is your module.
I'm attempting to use a proxy for a Pool that I'm creating and pass the ProxyAgent in options. Maybe this will help.
const pool = new Pool(url); const requestOptions = { ...someOptions }; pool.request(requstOptions);
I confirm this is a bug. when Pool is used, it's not picking up { ..., dispatcher: new ProxyAgent("...")}, nor setGlobalDispatcher(proxyAgent)
I think this is the same discussion as in https://github.com/nodejs/undici/issues/1270 or I'm missing something?
I can confirm the bug. It does not work when Pool is used.
This is a duplicate of https://github.com/nodejs/undici/issues/1270.