undici icon indicating copy to clipboard operation
undici copied to clipboard

HTTP Proxy with undici and HTTPDataSource

Open lordjim1985 opened this issue 4 years ago • 4 comments

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

lordjim1985 avatar Dec 23 '21 17:12 lordjim1985

cc @starpttech - I'm unsure how to proceed as it is your module.

mcollina avatar Dec 23 '21 17:12 mcollina

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);

lordjim1985 avatar Dec 23 '21 20:12 lordjim1985

I confirm this is a bug. when Pool is used, it's not picking up { ..., dispatcher: new ProxyAgent("...")}, nor setGlobalDispatcher(proxyAgent)

suil avatar Mar 07 '22 20:03 suil

I think this is the same discussion as in https://github.com/nodejs/undici/issues/1270 or I'm missing something?

RafaelGSS avatar Apr 12 '22 17:04 RafaelGSS

I can confirm the bug. It does not work when Pool is used.

umakanth-fmr avatar Sep 12 '22 17:09 umakanth-fmr

This is a duplicate of https://github.com/nodejs/undici/issues/1270.

mcollina avatar Sep 13 '22 14:09 mcollina