NIFI-13695 Fixed Redirect Handling for Custom UI Extensions

Appending a trailing slash when opening a custom UI and in the query string to fragment filter to avoid a Jetty-based redirect that could lead to losing the proxy path.

This closes #9222

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Matt Gilman 2024-08-30 10:20:23 -04:00 committed by exceptionfactory
parent 2951eef8a5
commit 31a3014696
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,8 @@ public class QueryStringToFragmentFilter implements Filter {
// Some NiFi front ends use hash based routing, so they don't need to know the baseHref. With hash based
// routing query parameters are implemented within the URL fragment. Because of this any query parameters on the
// original URL are not considered. This filter captures those and adds them to the fragment.
final RequestUriBuilder requestUriBuilder = RequestUriBuilder.fromHttpServletRequest(httpServletRequest).path(httpServletRequest.getContextPath()).fragment("/?" + queryString);
final String contextPath = httpServletRequest.getContextPath() + "/";
final RequestUriBuilder requestUriBuilder = RequestUriBuilder.fromHttpServletRequest(httpServletRequest).path(contextPath).fragment("/?" + queryString);
final URI redirectUri = requestUriBuilder.build();
final HttpServletResponse httpServletResponse = (HttpServletResponse) response;

View File

@ -81,7 +81,7 @@ export class AdvancedUi {
.set('editable', params.editable)
.set('disconnectedNodeAcknowledged', params.disconnectedNodeAcknowledged)
.toString();
const url = `${params.url}?${queryParams}`;
const url = `${params.url}/?${queryParams}`;
const sanitizedUrl = this.domSanitizer.sanitize(SecurityContext.URL, url);