-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support NO_PROXY and no_proxy #383
Support NO_PROXY and no_proxy #383
Comments
Thanks for the heads up. I'll add NO_PROXY to the PR and merge it soon. |
Thanks for the work on that PR @tomas. I think this issue can remain open for now to make sure needle can address the syntax usually used in Usually |
While mentioned in a needle Pull Request comment I believe lack of
NO_PROXY
support should be called out as its own issue.I noticed this behavior while using Pact, a contract testing library, as it previously used request but replaced it with needle. With the move to needle http requests started failing behind our corporate proxy as needle does not respect the
no_proxy
environment variable we have set for localhost. Specifically in our case http requests via needle to localhost (something Pact does when running a contract test) were going through our system proxy which ended up returning a 302 to a proxy blocked website.This issue is resolved if
config.proxy
were to be set tonull
prior to the needle.js proxy check when a URI is in theNO_PROXY
environment variableneedle/lib/needle.js
Lines 302 to 315 in 4cb2ef6
As an example in my use case manually adding
config.proxy = null
right before this check makes the network call behave as expected. This obviously is not the right fix just demonstrates that manually settingnull
here when desired seems to solve the problem. As an FYI the now deprecated request package already has logic to properly handleNO_PROXY
andno_proxy
, some of this could likely be leveraged here to add support forNO_PROXY
The text was updated successfully, but these errors were encountered: