-
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
Use HTTP_PROXY and HTTPS_PROXY from env, if set #382
Conversation
Hi @tomas thanks for this, I just found this and it'd be great for CI checks using https://github.com/tcort/markdown-link-check / https://github.com/tcort/link-check! Do you think you could add lowercase variables and For some more context, see: |
Ok just did a quick implementation for the NO_PROXY check. Havent tried it out though. :) |
@tomas I just tested the code snippet you added and this did not solve the problem for my use case. I'll have time to poke around a bit in the next hour or so and provide some feedback. |
Here is an example of what worked for me (functions taken from request library) master...sgoff0:sgoff0/no_proxy The big problem I ran into with your implementation is that Also it's important in my scenario that config.proxy is set to |
Hello, what's the status of this? Will you merge this soon? |
Looking at this now. Busy weeks lately, sorry for the wait. |
Thanks a lot! |
We should state in the documentation that it will automatically read Because not in all cases you want it to automatically apply the proxy settings in the environment variables. Before this I didn't know it would automatically apply the proxy settings of the environment variable, and later found this problem after troubleshooting, and now I pass |
That makes sense, though it's fairly standard behavior for most web clients to accept those environment variables by default, and the proper way to disable it is not to delete them but to use the |
Now in my case I don't want to let all requests go through the proxy, |
@nejch It should be properly parsed. What do you mean exactly? I'm also inclined to let the user use the NO_PROXY env variable if you want to skip proxying to a specific host declared in HTTP_PROXY, but I guess there might be a case where you want to instruct Needle to skip detection of env vars. |
@lyswhut I understand and this is a fairly common scenario, I'm just saying the standard way to do it is to define those hostnames, domains, or IPs in E.g. popular clients: I have no strong opinion of course, just wanted to share this, obviously you might want the option to do things differently programmatically :) @tomas thanks for the response! Currently needle does an exact URL match out of the comma-separated list provided in So for example if
Someone already pasted the This may be an even clearer approach from I don't really do JS on a daily basis so maybe you'd be faster to come up with something, not sure :) |
As you said, this is very common for an application, but Needle is just a request library, it is only one of the dependencies of the application, it is not provided to the end user, In my experience, the behavior of reading the environment variable proxy is generally only used in CLI programs |
Hmm, I've had the opposite experience as it really is baked into some other popular languages' stdlibs (even libcurl respects it, and the links above were also of popular request libraries), but if this is the more idiomatic approach in node then that makes sense, I'm definitely not a JS expert here :) I have seen proxy logic get reinvented a few times in JS projects, I guess node folks had their reasons to exclude it. @tomas the |
No worries @nejch, the discussion is worth it! |
Should fix #336 336