Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).These improvements are tested locally here, but help with some more testing would be appreciated!
(The same pr was created in the original module/node-apn#717, but ain't holding my breath for that to be merged..)