我已经使用命令成功地在容器中启动了Apache NiFi
docker run --name nifi -p 9090:9090 -d -e NIFI_WEB_HTTP_PORT='9090' apache/nifi:latest
并且可以连接到http://localhost:9090/nifi
上的UI-但是,我的公司仅允许子网之间的HTTPS连接,因此我使用Nginx通过以下配置将对https的调用反向代理到NiFi容器:
location /nifi/ {
proxy_set_header X-ProxyScheme "https";
proxy_set_header X-ProxyHost "mercury-dev";
proxy_set_header X-ProxyPort "443";
proxy_set_header X-ProxyContextPath "/nifi/";
proxy_pass http://mercury-dev:9090/nifi/;
}
location /nifi-docs/ {
proxy_set_header X-ProxyScheme "https";
proxy_set_header X-ProxyHost "mercury-dev";
proxy_set_header X-ProxyPort "443";
proxy_set_header X-ProxyContextPath "/nifi-docs/";
proxy_pass http://mercury-dev:9090/nifi-docs/;
}
location /nifi-api/ {
proxy_set_header X-ProxyScheme "https";
proxy_set_header X-ProxyHost "mercury-dev";
proxy_set_header X-ProxyPort "443";
proxy_set_header X-ProxyContextPath "/nifi-api/";
proxy_pass http://mercury-dev:9090/nifi-api/;
}
当我从远程计算机浏览到https://mercury-dev/nifi
时,NiFi UI开始加载,然后失败。屏幕错误显示An unexpected error has occurred. Please check the logs for additional details.
,Chrome开发者控制台报告:
/nifi-api/access/kerberos:1 Failed to load resource: the server responded with a status of 409 (Conflict)
/nifi-api/access/oidc/exchange:1 Failed to load resource: the server responded with a status of 409 (Conflict)
/nifi-api/flow/about:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
/nifi-api/flow/process-groups/root:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
[当我登录到容器并查看日志文件时,看到许多错误,例如ERROR [NiFi Web Server-21] org.apache.nifi.web.util.WebUtils The provided context path [/nifi-api] was not whitelisted
我在NiFi documentation中找到了使用nifi.web.proxy.host
和nifi.web.proxy.context.path
属性将主机和内容列入白名单的参考,但是我找不到如何执行的描述。
如何设置这些属性,或者使此容器在HTTPS代理后面运行?
Docker容器并未公开您需要直接针对此用例进行修改的所有设置,因此您有一些选择(对应于已编号的点)。
(常规)似乎您提供了多个上下文路径的配置,但没有提供root path(/
)。如文档中所述,NiFi应用程序内部有许多组件上下文路径,因此当将其放置在代理之后时,应该使用根路径。
nifi.properties
设置)。无法配置通过用户界面列出的这两个设置。 start.sh
文件列出了Docker映像此时接受的环境变量。要添加更多,请提交PR或start.sh
以请求改进。 [Kawa Kawamura提供了您可能感兴趣的反向代理后面运行的NiFi的open a Jira和文档。