-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Perform Proxy logic more like cURL #4616
Conversation
When are the npm config options used? I can't see any reference to them in the original issue other than when you bring them into the discussion and google searches don't really reveal anything about how they expected to be used beyond npm's own use. |
If node-red is launched via NPM and the npmrc (or CLI) has specified proxy options, I believe the correct thing to do is respect them. In the interest of getting this in, I could disable the npm proxy parts (there is an option There are a number issues and inconsistencies this covers including:
So it would be great if we can get it in. |
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.
Here are the places to change to exclude npm proxy options
One concern I have is how many settings this is added to the settings file - for a topic that has very rarely caused any questions or issues. Why can we not just have a standard behaviour in terms of upper-case and lower-case? Document which we will use in preference to the other and not expect users to have to understand all of these flags that have been added to the settings file. |
We could be opinionated and expose the finer control at a later if that is an issue. I mean, we dont really have to add anything at all to the settings file (since it has defaults) but we may wish to keep the e.g.
That way, the user can be least change back to legacy (if needed) and the unlisted options are considered "unsupported"/"subject to change" |
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.
Okay - lets go with what you've got - just remove the entries from the settings file to reduce noise.
closes #3904
Types of changes
Introduces a helper function
getProxyForUrl
that computes the proxy to use based on Env Vars and options provided in accordance with the discussion and linked articles in the issueProxy Variables Handling:
Proxy Environment Variables:
NPM Proxy Configuration:
Works with
npm_config_http_proxy
,npm_config_https_proxy
,npm_config_proxy
,npm_config_no_proxy
.Handles precedence of NPM proxy configurations over environment variables like HTTP_PROXY, HTTPS_PROXY, NO_PROXY.
Overall, the "Proxy Helper" function effectively handles various proxy configurations and environment variables, providing consistent and expected results according to the specified configurations.
Bugfix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Proposed changes
NR_PROXY_MODE
(setting tolegacy
reverts functionality)TODO
NR_PROXY_MODE
Checklist
npm run test
to verify the unit tests pass