You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2021/02/25 05:57:18 UTC

[nifi] 09/24: NIFI-8242 Ensure NiFi URL for redirects has a trailing slash in AccessResource

This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch support/nifi-1.13
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 414e6e62ffbdf21a50282a3f9b4b143e949cdfe2
Author: Bryan Bende <bb...@apache.org>
AuthorDate: Fri Feb 19 14:53:13 2021 -0500

    NIFI-8242 Ensure NiFi URL for redirects has a trailing slash in AccessResource
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #4834.
---
 .../src/main/java/org/apache/nifi/web/api/AccessResource.java       | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
index 73d2141..bf4a792 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
@@ -1611,11 +1611,13 @@ public class AccessResource extends ApplicationResource {
     private String getNiFiUri() {
         final String nifiApiUrl = generateResourceUri();
         final String baseUrl = StringUtils.substringBeforeLast(nifiApiUrl, "/nifi-api");
-        return baseUrl + "/nifi";
+        // Note: if the URL does not end with a / then Jetty will end up doing a redirect which can cause
+        // a problem when being behind a proxy b/c Jetty's redirect doesn't consider proxy headers
+        return baseUrl + "/nifi/";
     }
 
     private String getNiFiLogoutCompleteUri() {
-        return getNiFiUri() + "/logout-complete";
+        return getNiFiUri() + "logout-complete";
     }
 
     private void removeOidcRequestCookie(final HttpServletResponse httpServletResponse) {