Nathan Gough commented on NIFI-7870:

Sounds like this may be more complicated than first anticipated. Upon 
investigation, it appears that the advanced UI static assets are not accessible 
due to another change in -NIFI-7170- which was intended to disable anonymous 
access to API endpoints. This was not intended to block access to static 

When using LDAP, OIDC and perhaps other authentication mechanisms other than 
X509, a 'HTTP 401 Unauthorized' is returned for advanced UI static assets, 
which results in the Content-Type being returned as 'text/plain' (an error 
message) instead of the expected 'application/javascript' Content-Type. The 
server will show:

2020-10-01 19:30:38,159 INFO [NiFi Web Server-19] 
o.a.n.w.s.NiFiAuthenticationFilter Attempting request for (<anonymous>) GET 
 (source ip:
2020-10-01 19:30:38,159 WARN [NiFi Web Server-19] 
o.a.n.w.s.NiFiAuthenticationFilter Rejecting access to web api: Anonymous 
authentication has not been configured.{code}

This is because the NiFi UI does not include the JWT for requests to static 
assets, but authentication is being checked as anonymous authentication is now 
disabled by default. So, a 401 is returned.

The current workaround is to enable anonymous authentication which will allow 
access to static assets for advanced UI's (javascript etc):

A fix for this will likely involve a combination of explicitly allowing access 
to advanced UI static assets for UI's bundled with NiFi, and for external 
custom UI's, anonymous authentication will need to be enabled.

We expect that this will be a temporary change, with the long term goal of 
refactoring/redesigning some of these security features in a future release/a 
NiFi 2.0 release.

Also related is NIFI-7489

> X-Content-Type missing for advanced UI resources
> ------------------------------------------------
>                 Key: NIFI-7870
>                 URL: https://issues.apache.org/jira/browse/NIFI-7870
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core UI
>    Affects Versions: 1.12.0, 1.12.1
>            Reporter: Nathan Gough
>            Assignee: Nathan Gough
>            Priority: Critical
>              Labels: UI, content-type, header, security
> The X-Content-Type header was added in NiFi 1.12.0, which blocks resources in 
> the browser if they do not have the content type added. It appears that some 
> 'advanced UI' resources do not have the content type applied to their 
> resources and are blocked from loading.

This message was sent by Atlassian Jira

Reply via email to