I want to use an https nginx to proxy a non-secured nifi server running in the same box.
So far the closest I get is by using this configuration:
location ^~ /nifi {
proxy_set_header X-ProxyHost localhost;
proxy_set_header X-ProxyPort 6969;
proxy_set_header X-ProxyContextPath /nifi;
proxy_pass http://localhost:6969/nifi;
}
In nifi I get the exception:
2018-11-24 17:40:19,473 ERROR [NiFi Web Server-20] o.a.nifi.web.api.config.ThrowableMapper An unexpected error has occurred:
javax.ws.rs.core.UriBuilderException: The provided context path [/nifi] was not whitelisted []. Returning Internal Server Error response.
javax.ws.rs.core.UriBuilderException: The provided context path [/nifi] was not whitelisted []
at org.apache.nifi.web.util.WebUtils.verifyContextPath(WebUtils.java:152)
at org.apache.nifi.web.util.WebUtils.getResourcePath(WebUtils.java:125)
at org.apache.nifi.web.api.ApplicationResource.buildResourceUri(ApplicationResource.java:159)
at org.apache.nifi.web.api.ApplicationResource.generateResourceUri(ApplicationResource.java:141)
at org.apache.nifi.web.api.ProcessorResource.populateRemainingProcessorEntityContent(ProcessorResource.java:107)
at org.apache.nifi.web.api.ProcessorResource.populateRemainingProcessorEntitiesContent(ProcessorResource.java:95)
at org.apache.nifi.web.api.FlowResource.populateRemainingFlowStructure(FlowResource.java:200)
at org.apache.nifi.web.api.FlowResource.populateRemainingFlowContent(FlowResource.java:187)
at org.apache.nifi.web.api.FlowResource.getFlow(FlowResource.java:373)
Any hints?
Just update your
proxy_pass
to remove thenifi
suffix.nginx will append the entire
$uri
to theproxy_pass
url, so nginx was forwarding to http://localhost:6969/nifi/nifi/... instead of http://localhost:6969/nifi/...Additional to the answer above, try adding the
X-ProxyScheme
header.Also, if you are advertising your site for external access, modify the
X-ProxyHost
to your LAN accessible IP address or Internet accessible domain name. (i.e.mynifiwebaccess.com
,10.51.102.9
)I am not sure about your configuration but you could try making the port number for the
externally_advertised_port
on the code above different since NiFi might be running and using port6969
already.the error message: javax.ws.rs.core.UriBuilderException: The provided context path [/nifi] was not whitelisted [].
this is caused by nifi.web.proxy.context.path is not set properly.
check the doc:
https://docs.hortonworks.com/HDPDocuments/HDF3/HDF-3.3.0/nifi-configuration-best-practices/content/proxy_configuration.html