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

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 6ed496c  NIFI-8242 Ensure NiFi URL for redirects has a trailing slash 
in AccessResource
6ed496c is described below

commit 6ed496c714712b979d12f1eeba7da946e086c925
Author: Bryan Bende <[email protected]>
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 <[email protected]>
    
    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) {

Reply via email to