Repository navigation
Expose Undici's ProxyAgent and setGlobalDispatcher within Node #43187
Description
Activity
setGlobalDispatcheris exposed:global[Symbol.for('undici.globalDispatcher.1')] = yourDispatcher;
Reacted by Ari PerkkiöReplying to the last comment from @mcollina in the previous issue:
I would recommend opening up a separate issue about this topic and bringing it to the TSC. I don't think the whole of Undici has the stability guarantees needed to be part of the Node.js LTS cycle yet.
This makes sense! I'm not aware of Undici's process around stability guarantees like this, but I can understand how there are constraints there.
I do understand this isn't a top top priority since installing & importing Undici elsewhere is a usable workaround, so there's certainly no rush just would justify shipping an unstable API unnecessarily. I do think that the current situation isn't a good end state though, and there are good options we can aim for to fix this, so it would be great to find agreement to aim in that direction in the medium term.
I'm not sure how to take anything to the TSC, but very happy to be included on any discussion of this any time.
Reacted by aksjerglobal[Symbol.for('undici.globalDispatcher.1')] = yourDispatcher;
That's does work as a workaround, but it's not especially nice as the official API for this, and I think ProxyAgent needs to be available too to make this usable for global Fetch.
Reacted by Thayne McCombsI don't think we should expose
undicifurther until we want to considerfetchas stable.Reacted by Fongerfrank-dspeed commented
on May 24, 2022 on May 24, 2022 · Hidden as off-topicshow commentMore actions@mcollina
I don't think we should exposeundicifurther until we want to considerfetchas stable.2022-11-14, Version 19.1.0
- drop fetch experimental warning (Matteo Collina) lib: drop fetch experimental warning #45287
That does not mark it stable, on purpose. It's the first step on that journey. This is something we might want to consider right now.
- addedtsc-agendaIssues and PRs to discuss during Technical Steering Committee meetings.Issues and PRs to discuss during Technical Steering Committee meetings.
on Dec 5, 2022 In the TSC meeeting of today, we decided that we are going to support HTTP_PROXY, HTTPS_PROXY and NO_PROXY env variables directly in Undici: nodejs/undici#1650.
Reacted by Moshe Atlow, Niko, Niek van der Maas, Kai Sellgren, Steven, silverwind, Théo LUDWIG, Daniel Bankhead, EVA (Entity Value Attribute), Wu Wenbin and 1 moreReacted by Tim Perry, David Kowis, Travis Fischer, Niko, Kai Sellgren, James Masters, aksjer, Steven, silverwind and Daniel Bankhead- removedtsc-agendaIssues and PRs to discuss during Technical Steering Committee meetings.Issues and PRs to discuss during Technical Steering Committee meetings.
on Jan 18, 2023 How is it going to handle different casing rules?
Reacted by 沈鸿飞- added 2 commits that reference this issue
on Mar 2, 2023 setGlobalDispatcheris exposed:global[Symbol.for('undici.globalDispatcher.1')] = yourDispatcher;
Is there a workaround to obtain
ProxyAgent?Reacted by silverwind48 remaining items
- removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Aug 13, 2025 - added a commit that references this issue
on Oct 27, 2025 @mcollina is exposing some undici internals still in the plan? Couldn't find the tracking issue from the last collab summit
Is there currently any workaround to set proxy settings for specific requests that doesn't involve adding a dependency on undici?
Reacted by Arnold Hendriks, Jamie Birch and Vladislav Puzyrevgithub-actions commented
on Jun 25, 2026 on Jun 25, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jun 25, 2026 Would
http.setGlobalProxyFromEnv([env])solve this issue?@hyrious that doesn't solve my use case, because I need to use a proxy for some requests, but not all of them, so I can't set proxy settings globally.
Reacted by Leo Hanisch@tmccombs I see. I just searched for the implementation of fetch dispatcher and found that the dispatcher was captured instantly on calling fetch, so in theory there's a hacky way to make proxy happen per fetch without adding a new dependency:
async function fetchWithTemporaryGlobalProxy(url, init, proxyEnv) { const restore = setGlobalProxyFromEnv(proxyEnv); try { return fetch(url, init); } finally { restore(); } }
This is bound to the implementation so not that stable.
- removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jun 26, 2026 github-actions commented
on Sep 28, 2026 on Sep 28, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Sep 28, 2026 nostale
Reacted by sosoba, Owen Buckley and Erik Rasmussen- removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Sep 29, 2026
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriaged
Originally posted by @pimterry in #42814 (comment)