NiFi Disable Invalid Host Headers Check

Viewed 82

I am running NiFi within vagrant which can change the port forwarding under the hood as needed. By default, NiFi uses port 8443. Since my port 8443 is already taken, vagrant automatically forwards the port so that guest port 8443 links to host port 2208. This part is fine for me.

The problem is this. When I try to access NiFi on my host machine, I get this error:

$ curl -k https://localhost:2208 #<-- Since I am on the host, I need to use 2208 and not 8443.


<h1>System Error</h1>
<h2>The request contained an invalid host header [<code>localhost:2208</code>] in the request [<code>/</code>]. Check for request manipulation or third-party intercept.</h2>
<h3>Valid host headers are [<code>empty</code>] or: <br/><code>
<ul>
  <li>127.0.0.1</li>
  <li>127.0.0.1:8443</li>
  <li>localhost</li>
  <li>localhost:8443</li>
  <li>[::1]</li>
  <li>[::1]:8443</li>
  <li>rhel8.localdomain</li>
  <li>rhel8.localdomain:8443</li>
  <li>0.0.0.0</li>
  <li>0.0.0.0:8443</li>
</ul>

</code></h3>

It is essentially expecting either port 8443 (which is the right port if 8443 would be available on the host) or no port listed (so 443).

The solutions online is to change the following value in nifi.properties:

nifi.web.https.port=2208 #by default it is set to 8443.

Unfortunately, form within the guest VM, it does not know where the host forwarded the port. I.e., internal to the guest VM, it is port 8443.

What would be most simple is to just disable this Invalid Host Header error and just allow the traffic through. So my question is how do I disable this invalid host header check?

(Afterall, NiFi is username/password secured so I feel my bases are covered enough. Also this is an internal development machine and the ports can change. I don't need this level of security yet. By the time this is in production, the ports will be set in stone and I could go back to the default security...)

1 Answers
Related