NIFI-8242 Ensure NiFi URL for redirects has a trailing slash in AccessResource

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #4834.
This commit is contained in:
Bryan Bende 2021-02-19 14:53:13 -05:00 committed by Pierre Villard
parent 51e7bdf940
commit 6ed496c714
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
1 changed files with 4 additions and 2 deletions

View File

@ -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) {