Запуск Apache NiFi за Nginx - PullRequest
       46

Запуск Apache NiFi за Nginx

0 голосов
/ 25 сентября 2018

Я пытаюсь использовать nginx в качестве обратного прокси для подключения к nifi.Я использую следующий поток: локальный компьютер -> http -> NGINX -> https -> Secure NiFi

Ниже приведены мои настройки nifi.properties:

nifi.web.https.host=localhost
 nifi.web.https.port=8443
 nifi.web.https.network.interface.default=
 nifi.web.jetty.working.directory=./work/jetty
 nifi.web.jetty.threads=200
 nifi.web.max.header.size=16 KB
 nifi.web.proxy.context.path=/nifi/
 nifi.web.proxy.host=localhost:8443
 nifi.remote.input.host=localhost
 nifi.remote.input.secure=true

Ниже мой nginxконфигурация:

 server {
         listen       81;
         server_name  localhost;
     location /nifi/ {

        proxy_ssl_certificate     C:/nifi-toolkit-1.7.1/target/nifi-cert.pem;
        proxy_ssl_certificate_key C:/nifi-toolkit-1.7.1/target/nifi-key.key;
        proxy_ssl_server_name on;

        proxy_pass https://localhost:8443;
        proxy_set_header X-ProxyScheme "https";
        proxy_set_header X-ProxyHost $http_host;
        proxy_set_header X-ProxyPort 8443;
        proxy_set_header X-ProxyContextPath "";
        root   html;
        index  index.html index.htm;
    }

    location /nifi-api/{

        proxy_ssl_certificate     C:/nifi-toolkit-1.7.1/target/nifi-cert.pem;
        proxy_ssl_certificate_key C:/nifi-toolkit-1.7.1/target/nifi-key.key;
        proxy_ssl_server_name on;

        proxy_set_header X-ProxyScheme "https";
        proxy_set_header X-ProxyHost $http_host;
        proxy_set_header X-ProxyPort 443;
        proxy_set_header X-ProxyContextPath "";
        proxy_pass https://localhost:8443/nifi-api/;
 }
}

Когда я пытаюсь получить доступ к nifi через nginx, я получаю следующую ошибку в error.logs:

2018/09/25 15:41:55 [error] 100964#77892: *27 upstream timed out (10060: A `connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "POST /nifi-api/access/oidc/exchange HTTP/1.1", upstream: "https://[::1]:8443/nifi-api/access/oidc/exchange", host: "localhost:81", referrer: "http://localhost:81/nifi/"`

Ниже приведены ошибки, которые я получаю в своем браузере, когда нажимаюURL: http://localhost:81/nifi/

upstream timed out while calling nifi over nginx via https

Есть ли какие-либо параметры конфигурации, которые мне не хватает.Любая помощь будет оценена.

Заранее спасибо.

1 Ответ

0 голосов
/ 09 мая 2019

проблема в том, что nifi.web.proxy.context.path не установлен правильно.

проверьте документ:

https://docs.hortonworks.com/HDPDocuments/HDF3/HDF-3.3.0/nifi-configuration-best-practices/content/proxy_configuration.html

NiFi будетпринимать запросы HTTP только с заголовком X-ProxyContextPath или X-Forwarded-Context, если значение занесено в белый список в свойстве nifi.web.proxy.context.path в nifi.properties.Это свойство принимает список ожидаемых значений через запятую.Если входящий запрос имеет значение заголовка X-ProxyContextPath или X-Forwarded-Context, которого нет в белом списке, отобразится страница «Произошла непредвиденная ошибка», и ошибка будет записана в приложение nifi..log.

...