Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-7033

wrong redirect from login/logout page when behind a custom url prefix/context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.10.0, 1.14.0
    • 1.15.0
    • Core UI
    • None
    • NiFi official Docker Container, behind HAProxy, RHEL 7.6, Docker 18.06.0-ce

    Description

      Login/logout pages don't redirect properly when NiFi is deployed on a custom URL prefix (context). For example when deploying NiFi on custom URL like https://nifi-host/mynifi (using HAPROXY, setting nifi.web.proxy.host=mynifi), UI works perfectly (via https://nifi-host/mynifi/nifi/). Problem is with login/logout pages, which both don't seem to honor X-ProxyContextPath and after successfull login/logout they both redirect to https://nifi-host/nifi.

      After some investigations made, the problem on login page seems to be in nf-login.js containing hardcoded url in lines 121-125:

      if (accessStatus.status === 'ACTIVE') {
          // reload as appropriate - no need to schedule token refresh as the page is reloading
          if (top !== window) {
              parent.window.location = '/nifi';
          } else {
              window.location = '/nifi';
          }
      } else {
      ...
      

      where on logout page, redirect url is composed purely using HttpServletResponse in LogoutFilter.java, 53 (without examining X-ProxyContextPath):

      ((HttpServletResponse) response).sendRedirect("login");
      

      Found a similar issue with OpenID fixed few version ago, I am not sure if it is somehow related: NIFI-5237

       

      Attachments

        Issue Links

          Activity

            People

              exceptionfactory David Handermann
              diz2y Rastislav Krist
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m