Skip to content

New Node.js v18 fetch() HTTP API is not supported #52

@pimterry

Description

@pimterry

I'm opening this here to start discussion and see if there's a workaround. I imagine this might be an issue for Node.js itself, but it's worth considering if we can do anything in userland or what what exactly Node would need to expose.

Repro:

➜ export GLOBAL_AGENT_HTTP_PROXY=http://127.0.0.1:9000
➜ node
Welcome to Node.js v18.0.0.
Type ".help" for more information.
> require('global-agent').bootstrap();
true
> require('http').get('http://example.org') // Goes via proxy
...
> fetch('http://example.org') // Ignores proxy and always gets sent directly
...

Notably it is possible to configure Undici to always send requests via a proxy (using its setGlobalDispatcher method) but that doesn't seem to be accessible in Node anywhere.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions