Hi, I ran into some problems when using this package in Kubernetes using a HTTP proxy that requires authentication, so I made some improvements to the HTTP proxy implementation.
Improvements:
Added optional username and password proxy options. When specified this will set the Proxy-Authorization header with basic authentication.
Added support for retrieving HTTP proxy config from environment variables, instead of needing to specify it in options.
This is useful in environments where HTTP proxy is configured automatically through Kubernetes for example. This also follows a normal convention across tools and other request libraries, and is normally the expected behaviour (reference).
When one of the following environment variables is set we're using this value to connect (in this order):
To completely disable proxies and ignore environment variables set { proxy: false }. This is similar to how axios is handling proxy config.
Added support for the no_proxy environment variable that makes sure urls that shouldn't be proxied isn't. This is also a commonly supported variable across tools, and is become a convention. (Reference).
@florianreinhart I'm hoping you could review my pull request when you have a moment. If possible, I'd love to see this included in an upcoming release soon. :)
Hi, I ran into some problems when using this package in Kubernetes using a HTTP proxy that requires authentication, so I made some improvements to the HTTP proxy implementation.
Improvements:
Added optional
username
andpassword
proxy options. When specified this will set theProxy-Authorization
header with basic authentication.Added support for retrieving HTTP proxy config from environment variables, instead of needing to specify it in options. This is useful in environments where HTTP proxy is configured automatically through Kubernetes for example. This also follows a normal convention across tools and other request libraries, and is normally the expected behaviour (reference). When one of the following environment variables is set we're using this value to connect (in this order):
apn_proxy
npm_config_[http/https]_proxy
(npm config variable for http or https proxy)[http/https]_proxy
all_proxy
npm_config_proxy
(npm config variable for general proxy)proxy
To completely disable proxies and ignore environment variables set
{ proxy: false }
. This is similar to how axios is handling proxy config.Added support for the
no_proxy
environment variable that makes sure urls that shouldn't be proxied isn't. This is also a commonly supported variable across tools, and is become a convention. (Reference).