Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache NiFi - The request contained an invalid host header

Tags:

apache-nifi

I'm running an Apache NiFi instance using Docker at my workplace with a proxy in place. I pulled the official container down, spun up the container and set it to port over to 8081 instead of 8080 as the work proxy is set for 8080.

However when I try to access NiFi via the browser on my dev machine using http://localhost:8081/nifi I'm getting the following error appear

System Error

The request contained an invalid host header [localhost:8081] in the request [/nifi]. Check for request manipulation or third-party intercept.

I've found a couple of posts online mention the nifi.properties file, but I'm not very experienced with Docker outside of spinning up images.

If anyone can offer some guidance or a soltion that would be excellent. Many Thanks.

like image 711
Maltanis Avatar asked Mar 06 '23 22:03

Maltanis


1 Answers

If you don't want to modify the nifi.properties file directly, you can pass custom variables to the application during the Docker command using the -e flag. In your case, Docker is aware that port 8081 should map to 8080, but NiFi is not, and detects a mismatch on the incoming request host header. To pass this through, try using a command like the following.

docker run --name nifi \
-p 8081:8081 \
-d \
-e NIFI_WEB_HTTP_PORT='8081'
apache/nifi:latest
like image 156
Andy Avatar answered May 02 '23 07:05

Andy