Skip to content

Possibility to set proxy / agent? #5

Description

@wbern

With node-fetch it's possible to specify a proxy.

// npm install node-fetch
// npm install https-proxy-agent

const fetch = require('node-fetch');
const HttpsProxyAgent = require('https-proxy-agent');


(async () => {
    const proxyAgent = new HttpsProxyAgent('http://46.250.171.31:8080');
    const response = await fetch('https://httpbin.org/ip?json', { agent: proxyAgent});
    const body = await response.text();
    console.log(body);
})();

It would be great if we could specify the fetch options when using the node-loader.

In our org, we have a docker container that globally sets a proxy in the environment, which we only use for a select few calls (which are used inside node-loader-http), but other than that we don't use this proxy. If we were able to configure the proxy for node-loader-http we'd be able to disable proxy on a global level.

I wouldn't mind making a PR to address this, just wondering if it's OK that I go ahead and if there's any possible pitfall that I may need to consider.

Activity

  1. wbern commented on Feb 26, 2022

    @wbern
    Author

    @joeldenning appreciate that it's hard to keep up with everything.

    Do you want us to proceed with this PR or do you suggest we fork it? Either way works for us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions