You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Paulo & Claudio <cl...@gmail.com> on 2018/03/27 19:59:10 UTC
Setting NIFI_HTTP_WEB_HOST in Docker doesn't work
Hello. I have installed NiFi Docker on a Google Cloud Debian 9 server.
The server has a public IP of PUBLIC_IP (placeholder for the real IP).
I ran docker pull apache/nifi and it installed the image successfully.
Then, I ran:
sudo docker run --name nifi -p 8080:8080 -d -e NIFI_HTTP_WEB_HOST=PUBLIC_IP
-e NIFI_HTTP_WEB_PORT=8080 apache/nifi:latest
Since I set NIFI_HTTP_WEB_HOST to my PUBLIC_IP, and I have allowed the port
8080 in the Google Cloud console, I would assume that
http://PUBLIC_IP:8080/nifi/ would work... instead, I get this:
"System Error
The request contained an invalid host header [PUBLIC_IP:8080] in the
request [/nifi/]. Check for request manipulation or third-party intercept."
When I run sudo docker logs nifi, I see the following warning:
o.a.nifi.web.server.HostHeaderHandler Request host header [PUBLIC_IP:8080]
different from web hostname [f3d104266d9a(:8080)]
Any clue on why that might be happening?
I found a few sites that suggested setting nifi.web.http.host in
nifi.properties, but I don't know how to do that in Docker. Plus, I thought
that the NIFI_HTTP_WEB_HOST setting served exacly for that purpose. Am I
missing something?
Thank you in advance.
Re: Setting NIFI_HTTP_WEB_HOST in Docker doesn't work
Posted by pcsegal <cl...@gmail.com>.
Hello,
Thank you for your reply.
I tried like this:
sudo docker run --name nifi -p 8080:8080 -d -e NIFI_WEB_HTTP_HOST=PUBLIC_IP
-e NIFI_WEB_HTTP_PORT=8080 apache/nifi:latest
And unfortunately I got an error. Here is the stack trace:
2018-03-27 21:44:34,590 WARN [main] org.apache.nifi.web.server.JettyServer
Failed to start web server... shutting down.
java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at
org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:298)
at
org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at
org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:431)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at
org.apache.nifi.web.server.JettyServer.start(JettyServer.java:798)
at org.apache.nifi.NiFi.<init>(NiFi.java:160)
at org.apache.nifi.NiFi.main(NiFi.java:268)
2018-03-27 21:44:34,595 INFO [Thread-1] org.apache.nifi.NiFi Initiating
shutdown of Jetty web server...
2018-03-27 21:44:34,637 INFO [Thread-1]
o.eclipse.jetty.server.AbstractConnector Stopped
ServerConnector@3f9cfdc3{HTTP/1.1,[http/1.1]}{35.226.213.175:8080}
2018-03-27 21:44:34,642 INFO [Thread-1] org.eclipse.jetty.server.session
Stopped scavenging
Received trapped signal, beginning shutdown...
--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
Re: Setting NIFI_HTTP_WEB_HOST in Docker doesn't work
Posted by Aldrin Piri <al...@gmail.com>.
Hello,
Could you please try with NIFI_WEB_HTTP_HOST instead of NIFI_HTTP_WEB_HOST?
It seems we are lacking documentation around this, but stems from [1].
If that does not work, could you also verify you have the latest Docker
image and try again? (docker pull apache/nifi:latest)
Using the latest image in conjunction with NIFI_WEB_HTTP_HOST, I am able to
verify successful hostname setting. A couple quick commands to verify this
are:
docker run --name nifi \
-p 9090:9090 \
-d \
-e NIFI_WEB_HTTP_PORT='9090' \
-e NIFI_WEB_HTTP_HOST='puppytown' \
apache/nifi:latest
I then verify the change occurred with the following:
docker exec nifi grep host /opt/nifi/nifi-1.5.0/conf/nifi.properties
[1]
https://github.com/apache/nifi/blob/master/nifi-docker/dockerhub/sh/start.sh#L24
On Tue, Mar 27, 2018 at 3:59 PM, Paulo & Claudio <cl...@gmail.com>
wrote:
> Hello. I have installed NiFi Docker on a Google Cloud Debian 9 server.
>
> The server has a public IP of PUBLIC_IP (placeholder for the real IP).
>
> I ran docker pull apache/nifi and it installed the image successfully.
>
> Then, I ran:
> sudo docker run --name nifi -p 8080:8080 -d -e NIFI_HTTP_WEB_HOST=PUBLIC_IP
> -e NIFI_HTTP_WEB_PORT=8080 apache/nifi:latest
>
> Since I set NIFI_HTTP_WEB_HOST to my PUBLIC_IP, and I have allowed the port
> 8080 in the Google Cloud console, I would assume that
> http://PUBLIC_IP:8080/nifi/ would work... instead, I get this:
>
> "System Error
> The request contained an invalid host header [PUBLIC_IP:8080] in the
> request [/nifi/]. Check for request manipulation or third-party intercept."
> When I run sudo docker logs nifi, I see the following warning:
>
> o.a.nifi.web.server.HostHeaderHandler Request host header [PUBLIC_IP:8080]
> different from web hostname [f3d104266d9a(:8080)]
>
> Any clue on why that might be happening?
>
> I found a few sites that suggested setting nifi.web.http.host in
> nifi.properties, but I don't know how to do that in Docker. Plus, I thought
> that the NIFI_HTTP_WEB_HOST setting served exacly for that purpose. Am I
> missing something?
>
> Thank you in advance.
>