[
https://issues.apache.org/jira/browse/NIFI-4199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16478529#comment-16478529
]
ASF GitHub Bot commented on NIFI-4199:
--------------------------------------
Github user ijokarumawak commented on the issue:
https://github.com/apache/nifi/pull/2704
@ottobackwards You are talking about these code specifically?
```
HTTPUtils.setProxy(context, clientBuilder, credentialsProvider);
```
Then yes, the above util method accepts HttpClientBuilder and useful for
processors those only use HttpClient library. It's currently used from only
GetHTTP and PostHTTP. It's just a convenient method for those two for now.
Other processors who don't use HttpClient, uses ProxyConfiguration directly
to get proxy settings. Following snippet is copied from AbstractAWSProcessor:
```
// Get Proxy configuration from ProxyConfigurationService if it's used, or
from processor's own proxy configurations, either way, the configurations are
put into the `proxyConfig` instance. And subsequent code do not have to care
how where these settings are set.
final ProxyConfiguration proxyConfig =
ProxyConfiguration.getConfiguration(context, () -> {
if (context.getProperty(PROXY_HOST).isSet()) {
final ProxyConfiguration componentProxyConfig = new
ProxyConfiguration();
String proxyHost =
context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
Integer proxyPort =
context.getProperty(PROXY_HOST_PORT).evaluateAttributeExpressions().asInteger();
String proxyUsername =
context.getProperty(PROXY_USERNAME).evaluateAttributeExpressions().getValue();
String proxyPassword =
context.getProperty(PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
componentProxyConfig.setProxyType(Proxy.Type.HTTP);
componentProxyConfig.setProxyServerHost(proxyHost);
componentProxyConfig.setProxyServerPort(proxyPort);
componentProxyConfig.setProxyUserName(proxyUsername);
componentProxyConfig.setProxyUserPassword(proxyPassword);
return componentProxyConfig;
}
return ProxyConfiguration.DIRECT_CONFIGURATION;
});
// Apply Proxy settings to underlying SDK/API.
if (Proxy.Type.HTTP.equals(proxyConfig.getProxyType())) {
config.setProxyHost(proxyConfig.getProxyServerHost());
config.setProxyPort(proxyConfig.getProxyServerPort());
if (proxyConfig.hasCredential()) {
config.setProxyUsername(proxyConfig.getProxyUserName());
config.setProxyPassword(proxyConfig.getProxyUserPassword());
}
}
```
Does that answer to your question?
> NiFi processors should be able to share proxy settings
> ------------------------------------------------------
>
> Key: NIFI-4199
> URL: https://issues.apache.org/jira/browse/NIFI-4199
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Andre F de Miranda
> Assignee: Koji Kawamura
> Priority: Major
>
> Currently, configuring proxy settings for NiFi processors may be a tedious
> process that requires the DFM to set proxy settings on individual processors.
> This leads to:
> * Duplication of work
> * Management overhead (as password must be changed on multiple locations)
> * Lower security (as proxy credentials must be known by "n" DFMs)
> Ideally, NiFi should offer a way to minimise duplication of work by offering
> a something similar to the Standard SSL Context services. This way, the DFM
> could set the proxy settings once an all authorised users could tap into
> those settings.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)