-
Notifications
You must be signed in to change notification settings - Fork 483
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
enable proxy if https_proxy taken by env #39
base: main
Are you sure you want to change the base?
Conversation
I would have expected Anyway, can you handle the following env vars:
Thanks! |
i see, i'll try it. |
* ignore cases of http/s_proxy * not apply if host include no_proxy
got it. please check it |
const getProxyAgent = (wit_url) => { | ||
const url = Url.parse(wit_url); | ||
const proxy = url.protocol === "http:" ? | ||
process.env.http_proxy || process.env.HTTP_PROXY || null : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would avoid the || null, for we are only checking for falseyness below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool! there seems to be conflicts though. Apologies it has taken so long to review @muddydixon. Will merge as soon as this is rebased
process.env.http_proxy || process.env.HTTP_PROXY || null : | ||
process.env.https_proxy || process.env.HTTPS_PROXY || null; | ||
const noProxy = process.env.no_proxy || process.env.NO_PROXY; | ||
if(!proxy) return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe we can rewrite like so ->
const shouldIgnore = noProxy && noProxy.indexOf(url.hostname > -1
if (proxy && !shouldIgnore) {
return new HttpsProxyAgent(proxy)
}
thx, fixed it |
Is there any progress on this? We need proxy support and would really like to use the official package. |
I fixed it above commit. you check it? |
I wanted to know when this will be merged into master. Currently I have reimplemented muddydixon's solution in my own repository and we're using that, as the merge conflicts were too big to merge easily. For the future it would be nice if the official module supported this. My fork is currently on top of of master so it could be merged easily. |
Hi, I found this issue as I need to use this package behind an HTTP proxy too. I'd be very keen on this PR being merged - @muddydixon, would you be able to rebase to fix conflicts so it can be merged? Currently I'm trying to work around this issue by using iptables to intercept requests to Wit's API which isn't ideal! |
I think I'm not the only one interested by this, but I don't feel like I have the knowledge to finish the rebase of this branch. |
I'll surface this back with the team to see if we can prioritize it. |
Abstract
enable proxy if https_proxy taken by env.