[英]Connecting to an external HTTP api behind a proxy from nifi
I have a apache/nifi:latest
instance spun inside an Amazon Linux 2 EC2.我在 Amazon Linux 2 EC2 中有一个
apache/nifi:latest
实例。 For reference, see this guide: here作为参考,请参阅本指南: 此处
I have a QuerySalesforceObject
ver.我有一个
QuerySalesforceObject
。 1.18.0
that makes use of StandardOauth2AccessTokenProvider. 1.18.0
使用 StandardOauth2AccessTokenProvider。
The oauth2 provider url is configured at https://test.salesforce.com/services/oauth2/token oauth2 提供者 url 配置在https://test.salesforce.com/services/oauth2/token
I can curl
this url from the box and from inside the docker container just fine (I don't get a timeout).我可以
curl
这个 url 从盒子里和从 docker 容器里面就好了(我没有超时)。
[root@ip-10-229-18-107 \~\]# docker exec -it nifi_container_persistent /bin/sh
printenv | grep -i proxy
HTTPS_PROXY=http://proxy.MY_DOMAIN.com:3128
no_proxy=localhost,127.0.0.1,MY_DOMAIN.com,.amazonaws.com
NO_PROXY=localhost,127.0.0.1, MY_DOMAIN.com,.amazonaws.com
https_proxy=http://proxy.MY_DOMAIN.com:3128
http_proxy=http://proxy.MY_DOMAIN.com:3128
HTTP_PROXY=http://proxy.MY_DOMAIN.com:3128
curl https://test.salesforce.com/services/oauth2/token
{"error":"unsupported_grant_type","error_description":"grant type not supported"}#
But when I run the task, oauth2 fails with an error但是当我运行任务时,oauth2 失败并出现错误
java.io.UncheckedIOException: OAuth2 access token request failed
Caused by: java.net.SocketTimeoutException: connect timed out
This leads me to believe the proxy settings are not being honored by the class. How can I fix this?这让我相信代理设置没有被 class 接受。我该如何解决这个问题?
Here's more info on this class: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-oauth2-provider-nar/1.17.0/org.apache.nifi.oauth2.StandardOauth2AccessTokenProvider/index.html这是关于这个 class 的更多信息: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-oauth2-provider-nar/1.17.0/org.883528382088.0 .StandardOauth2AccessTokenProvider/index.html
The standard way to interface with HTTP resources with a proxy in Nifi is via StandardProxyConfigurationService
: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-proxy-configuration-nar/1.19.1/org.apache.nifi.proxy.StandardProxyConfigurationService/index.html在 Nifi 中使用代理连接 HTTP 资源的标准方法是通过
StandardProxyConfigurationService
: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-proxy-configuration-nar/1.19 .1/org.apache.nifi.proxy.StandardProxyConfigurationService/index.html
If a component does not have this property, then it means it does not support it.如果一个组件没有这个属性,那么就意味着它不支持它。
You can try bootstrapping proxy settings into nifi with /opt/nifi/nifi-current/conf/bootstrap.conf
.您可以尝试使用 /opt/nifi/nifi-current/conf/bootstrap.conf 将代理设置引导到
/opt/nifi/nifi-current/conf/bootstrap.conf
中。 But there is no standard and support of proxy is not guaranteed.但是没有标准,不能保证对代理的支持。 Implementation (bugs and all) depends on the library.
实现(错误和所有)取决于库。
aws-java-sdk
ver. aws-java-sdk
版本。 1x, for example, has a bug where nonProxyHosts
is not honoured.例如,1x 有一个错误,其中
nonProxyHosts
不被接受。 https://github.com/aws/aws-sdk-java/issues/2797 https://github.com/aws/aws-sdk-java/issues/2797
java.arg.18=-Dhttp.nonProxyHosts="foo|localhost|*.bar.org"
java.arg.19=-Dhttp.proxyHost=proxy.foo.com
java.arg.20=-Dhttp.proxyPort=123
java.arg.21=-Dhttp.proxyUser=foo
java.arg.22=-Dhttp.proxyPassword=bar
java.arg.23=-Dhttps.nonProxyHosts="foo|localhost|*.bar.org"
java.arg.24=-Dhttps.proxyHost=proxy.foo.com
java.arg.25=-Dhttps.proxyPort=123
java.arg.26=-Dhttps.proxyUser=foo
java.arg.27=-Dhttps.proxyPassword=bar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.