Ensuring the proxy headers are considered when redirecting the user following a OIDC or Knox login exchange.
This closes
@@ -266,7 +266,7 @@ public class AccessResource extends ApplicationResource {
}
// redirect to the name page
- httpServletResponse.sendRedirect("../../../nifi");
+ httpServletResponse.sendRedirect(getNiFiUri());
} else {
// remove the oidc request cookie
removeOidcRequestCookie(httpServletResponse);
@@ -369,7 +369,7 @@ public class AccessResource extends ApplicationResource {
return;
}
- httpServletResponse.sendRedirect("../../../nifi");
+ httpServletResponse.sendRedirect(getNiFiUri());
}
/**
@@ -740,6 +740,12 @@ public class AccessResource extends ApplicationResource {
return generateResourceUri("access", "oidc", "callback");
}
+ private String getNiFiUri() {
+ final String nifiApiUrl = generateResourceUri();
+ final String baseUrl = StringUtils.substringBeforeLast(nifiApiUrl,"/nifi-api");
+ return baseUrl + "/nifi";
+ }
+
private void removeOidcRequestCookie(final HttpServletResponse httpServletResponse) {
final Cookie cookie = new Cookie(OIDC_REQUEST_IDENTIFIER, null);
cookie.setPath("/");
