From 89b49167a5a7b78cb25d2ee56ac011f344e9c9e4 Mon Sep 17 00:00:00 2001 From: Giovanni Matteo Fumarola Date: Thu, 8 Nov 2018 14:52:24 -0800 Subject: [PATCH] HADOOP-15903. Allow HttpServer2 to discover resources in /static when symlinks are used. Contributed by Inigo Goiri. --- .../src/main/java/org/apache/hadoop/http/HttpServer2.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java index a9c23198e1..598d3ee146 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java @@ -84,6 +84,7 @@ import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.SessionManager; import org.eclipse.jetty.server.SslConnectionFactory; +import org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.RequestLogHandler; @@ -725,6 +726,7 @@ protected void addDefaultApps(ContextHandlerCollection parent, asm.getSessionCookieConfig().setSecure(true); } logContext.setSessionHandler(handler); + logContext.addAliasCheck(new AllowSymLinkAliasChecker()); setContextAttributes(logContext, conf); addNoCacheFilter(logContext); defaultContexts.put(logContext, true); @@ -747,6 +749,7 @@ protected void addDefaultApps(ContextHandlerCollection parent, asm.getSessionCookieConfig().setSecure(true); } staticContext.setSessionHandler(handler); + staticContext.addAliasCheck(new AllowSymLinkAliasChecker()); setContextAttributes(staticContext, conf); defaultContexts.put(staticContext, true); }