[core] allow programmatic configuration of no proxy list
See original GitHub issueOne problem with current approach is that we load the noProxyList from NO_PROXY env var and cache it in first proxyPolicy()
call, therefore
- it is not possible to change the list when creating new pipelines.
- it is not easy to configure noProxyList programmatically. For example, storage explorer allow users to configure proxy settings from the UI instead of using the NO_PROXY environment variable.
To address 1) we should remove the caching and load the list every time proxyPolicy()
is called.
For 2) maybe add a parameter for noProxyList?
export function proxyPolicy(proxySettings?: ProxySettings, customNoProxyList?: string[]): RequestPolicyFactory {
if (!proxySettings) {
proxySettings = getDefaultProxySettings();
}
noProxyList = customNoProxyList ?? loadNoProxy();
return {
create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions) => {
return new ProxyPolicy(nextPolicy, options, proxySettings!);
}
};
}
Another question is do we want to make noProxyList per ProxyPolicy, similar to proxySettings? There might be case where two clients from different SDK libraries want to use different set of proxy configurations. This will then make the noProxyList and the byPassedList cache per ProxyPolicy
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Working with HTTP Proxies | OpenShift Container Platform 3.11
The NO_PROXY environment variable lists all of the OpenShift Container Platform components and all IP addresses that are managed by OpenShift Container ...
Read more >Java Networking and Proxies
All proxies are defined by a host name and a port number. The later is optional as, if it is not specified, a...
Read more >Can't consume web services via an HTTP proxy server
To designate the proxy server explicitly, use either the Machine. config or Web. config file, or specify the server programmatically.
Read more >C# Connecting Through Proxy
config. You can programmatically create a proxy like so: HttpWebRequest request = (HttpWebRequest)WebRequest. Create("[ultimate destination of your request]"); ...
Read more >Proxy server settings
Use this page to perform advanced configuration on a proxy server. Proxy settings enable the system administrator to fine tune the behavior of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Storage Explorer is currently in the process of adding direct support for NO_PROXY.
Storage Explorer allows users to specify proxy settings using either system proxy settings, custom app proxy settings, or environment variables. Users can change these settings at any time, which means we need to be able to support changing proxy information used by the various networking modules we use (
request
, Azure SDK, etc.). This is further complicated by the fact that Storage Explorer is spread out across several processes. Relying on environment variables for proxy settings is not sufficient without a full app restart.Here’s how we intend to handle environment variables in 1.21.0:
Because different modules treat environment variables differently, we avoid setting process environment variables and rely on things like proxy policies or options. The read-once caching behavior for NO_PROXY is a good example. In order to work around that behavior, we have to implement the NO_PROXY behavior ourselves. If the URL matches one of the patterns in NO_PROXY, we skip applying a proxy policy to that request.
If the SDK supported a “no proxy” list when creating a proxy policy, that would remove the need for us to do the no-proxy check ourselves.
Here’s our work item: microsoft/AzureStorageExplorer#2685
@xirzec We’re already doing that, actually. We create a new client for every operation that is performed. Then we discard it when the operation completes and returns.
Historically, we never relied on environment variables. But users were reporting issues when their environments had these variables set. Since the underlying networking modules already used these variables, we thought at first just using them would be the way to go, and it seemed to work with HTTPS_PROXY and HTTP_PROXY.
Since environment variables are essentially language/platform-independent versions of global variables…well, we learned that wasn’t a good idea.