Search code examples
proxyapache-nifi

Nifi - Invalid cors request when uploading template, behind proxy


I have set up a secure NiFi instance (with keycloak) in docker behind proxy. Although everything works as expected when I try to upload a template NiFi gives me "invalid cors request" error and in developer tools I get 403 unauthorized. If i try to upload the template through the server:port it works fine. Does anyone have any idea how to solve this?

I already tried some headers in apache directives but as fas as i can understand the problem is not the cors error but the 403 unauthorized.

I followed these these steps in order to integrate NiFi with keycloak.

Thank you for your time and effort!


Solution

  • For anyone that might face this issue in the future. The error indicates that the request is not authorized behind proxy - Ngnix cant authorize the request (from NiFi was authorized) .

    I was able to fix this by adding these to my apache directives section:

    ProxyPreserveHost       On
    ProxyRequests           Off
    AllowEncodedSlashes     NoDecode
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"