Support HTTP_PROXY and NO_PROXY env var
See original GitHub issueA somewhat standard env var used in proxying applications is the HTTP_PROXY
and NO_PROXY
variables.
Undici should support automatically setting a global dispatcher if HTTP_PROXY env var is used. Currently Undici supports using setGlobalDispatcher()
method to set a specific proxy endpoint.
However there is a sister environment variable to HTTP_PROXY that supports contextually non-proxying domains: NO_PROXY
NO_PROXY requires a list of domain names to be NOT proxied and should make a request normally.
If any of the above cannot be supported, then Undici (and ultimately Node’s Fetch-Undici) should allow per-request proxy settings or function hook to allow anyone to develop the same effect as HTTP_PROXY and NO_PROXY env var in their application that uses Undici/Node Fetch.
Thoughts?
Issue Analytics
- State:
- Created a year ago
- Comments:12 (8 by maintainers)
Also read https://about.gitlab.com/blog/2021/01/27/we-need-to-talk-no-proxy/. It gives an overview of the different implementations and the last two paragraphs give good advice on how to implement.
I plan to create a module that exactly implements such a parser.
We probably should cleanly re-implement https://github.com/Rob--W/proxy-from-env because that module includes support for
npm_config_*
variables which I think has no place in module that is supposed to only support the standard environment variables. See discussion in https://github.com/Rob--W/proxy-from-env/issues/13.