From e8f6ff440a6b7114f9374c227ef2fa896e707f26 Mon Sep 17 00:00:00 2001 From: Koji Kawamura Date: Thu, 21 Dec 2017 14:11:14 +0900 Subject: [PATCH] NIFI-4714 - Use lowercase hostname for validation. Signed-off-by: Pierre Villard This closes #2355. --- .../java/org/apache/nifi/web/server/HostHeaderHandler.java | 4 ++-- .../nifi/web/server/HostHeaderSanitizationCustomizer.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java index 0b3a8bedd8..61e825d02b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java @@ -62,8 +62,8 @@ public class HostHeaderHandler extends ScopedHandler { // Different from customizer -- empty is ok here validHosts.add(""); try { - validHosts.add(InetAddress.getLocalHost().getHostName()); - validHosts.add(InetAddress.getLocalHost().getHostName() + ":" + serverPort); + validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase()); + validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase() + ":" + serverPort); } catch (final Exception e) { logger.warn("Failed to determine local hostname.", e); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderSanitizationCustomizer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderSanitizationCustomizer.java index 5a10610246..3a7b22b2e9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderSanitizationCustomizer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderSanitizationCustomizer.java @@ -55,8 +55,8 @@ public class HostHeaderSanitizationCustomizer implements HttpConfiguration.Custo validHosts.add("localhost"); validHosts.add("localhost:" + serverPort); try { - validHosts.add(InetAddress.getLocalHost().getHostName()); - validHosts.add(InetAddress.getLocalHost().getHostName() + ":" + serverPort); + validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase()); + validHosts.add(InetAddress.getLocalHost().getHostName().toLowerCase() + ":" + serverPort); } catch (final Exception e) { logger.warn("Failed to determine local hostname.", e); }