Skip to content

Commit effd177

Browse files
committed
HDFS-4471. Namenode WebUI file browsing does not work with wildcard addresses configured. Contributed by Andrew Wang.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1443807 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9bc39b7 commit effd177

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ Release 2.0.4-beta - UNRELEASED
314314
HDFS-4470. Several HDFS tests attempt file operations on invalid HDFS
315315
paths when running on Windows. (Chris Nauroth via suresh)
316316

317+
HDFS-4471. Namenode WebUI file browsing does not work with wildcard
318+
addresses configured. (Andrew Wang via atm)
319+
317320
Release 2.0.3-alpha - 2013-02-06
318321

319322
INCOMPATIBLE CHANGES

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.lang.management.MemoryUsage;
2626
import java.net.InetAddress;
2727
import java.net.InetSocketAddress;
28+
import java.net.URI;
2829
import java.net.URLEncoder;
2930
import java.security.PrivilegedExceptionAction;
3031
import java.util.ArrayList;
@@ -453,7 +454,13 @@ static void redirectToRandomDataNode(ServletContext context,
453454
nodeToRedirect = nn.getHttpAddress().getHostName();
454455
redirectPort = nn.getHttpAddress().getPort();
455456
}
456-
String addr = nn.getNameNodeAddressHostPortString();
457+
458+
InetSocketAddress rpcAddr = nn.getNameNodeAddress();
459+
String rpcHost = rpcAddr.getAddress().isAnyLocalAddress()
460+
? URI.create(request.getRequestURL().toString()).getHost()
461+
: rpcAddr.getAddress().getHostAddress();
462+
String addr = rpcHost + ":" + rpcAddr.getPort();
463+
457464
String fqdn = InetAddress.getByName(nodeToRedirect).getCanonicalHostName();
458465
redirectLocation = HttpConfig.getSchemePrefix() + fqdn + ":" + redirectPort
459466
+ "/browseDirectory.jsp?namenodeInfoPort="

0 commit comments

Comments
 (0)