@sap-ux/axios-extension 1.21.3 → 1.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.adoc +6 -5
- package/dist/factory.js +3 -1
- package/package.json +1 -1
package/README.adoc
CHANGED
|
@@ -120,20 +120,21 @@ See more examples in link:./test/factory.test.ts[/test/factory.test.ts]
|
|
|
120
120
|
|
|
121
121
|
## Proxy Support
|
|
122
122
|
|
|
123
|
-
To enable support for TLS (Transport Layer Security)
|
|
123
|
+
To enable support for TLS (Transport Layer Security) connections when using `HTTPS_PROXY`, update your environment by setting the `TOOLSUITE_FEATURES` environment variable with `sap.ux.enablePatchProxy`, as shown;
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
+
export TOOLSUITE_FEATURES=sap.ux.enablePatchProxy
|
|
126
127
|
export HTTPS_PROXY=<YOUR-PROXY:PORT>
|
|
127
|
-
# With Credentials
|
|
128
|
-
export HTTPS_PROXY=<USERNAME>:<PASSWORD>@<YOUR-PROXY:PORT>
|
|
129
128
|
```
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
In order to support credentials in the proxy URL, you can set the `HTTPS_PROXY` environment variable to include the username and password in the URL. For example:
|
|
131
|
+
|
|
132
132
|
```bash
|
|
133
|
+
export TOOLSUITE_FEATURES=sap.ux.enablePatchProxy
|
|
133
134
|
export HTTPS_PROXY=http://user:password@proxy.domain.com:3128
|
|
134
135
|
```
|
|
135
136
|
|
|
136
|
-
Ensure you restart any running processes
|
|
137
|
+
Ensure you restart any running processes to apply the changes.
|
|
137
138
|
|
|
138
139
|
Example Scenario
|
|
139
140
|
|
package/dist/factory.js
CHANGED
|
@@ -20,6 +20,7 @@ const patchTls_1 = require("./base/patchTls");
|
|
|
20
20
|
const proxy_from_env_1 = require("proxy-from-env");
|
|
21
21
|
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
22
22
|
const http_proxy_agent_1 = require("http-proxy-agent");
|
|
23
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
23
24
|
/**
|
|
24
25
|
* PatchedHttpsProxyAgent is a custom implementation of HttpsProxyAgent that allows to pass additional options, currently not supported by the original implementation when calling tls.connect
|
|
25
26
|
*/
|
|
@@ -61,7 +62,8 @@ function createInstance(ProviderType, config) {
|
|
|
61
62
|
rejectUnauthorized: !providerConfig.ignoreCertErrors
|
|
62
63
|
};
|
|
63
64
|
const localProxy = (0, proxy_from_env_1.getProxyForUrl)(config.baseURL);
|
|
64
|
-
|
|
65
|
+
const isPatchProxyEnabled = (0, feature_toggle_1.isFeatureEnabled)('sap.ux.enablePatchProxy');
|
|
66
|
+
if (isPatchProxyEnabled && localProxy) {
|
|
65
67
|
// axios doesn't handle proxies correctly, instead use a custom agent with axios proxy disabled
|
|
66
68
|
providerConfig.httpsAgent = new PatchedHttpsProxyAgent(localProxy, agentOptions);
|
|
67
69
|
providerConfig.httpAgent = new http_proxy_agent_1.HttpProxyAgent(localProxy);
|
package/package.json
CHANGED