|
81 | 81 | import org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector; |
82 | 82 | import org.apache.hbase.thirdparty.org.eclipse.jetty.server.SslConnectionFactory; |
83 | 83 | import org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.ContextHandlerCollection; |
| 84 | +import org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.ErrorHandler; |
84 | 85 | import org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.HandlerCollection; |
85 | 86 | import org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.RequestLogHandler; |
86 | 87 | import org.apache.hbase.thirdparty.org.eclipse.jetty.server.handler.gzip.GzipHandler; |
@@ -153,6 +154,7 @@ public class HttpServer implements FilterContainer { |
153 | 154 | public static final String SPNEGO_PROXYUSER_FILTER = "SpnegoProxyUserFilter"; |
154 | 155 | public static final String NO_CACHE_FILTER = "NoCacheFilter"; |
155 | 156 | public static final String APP_DIR = "webapps"; |
| 157 | + public static final String HTTP_UI_SHOW_STACKTRACE_KEY = "hbase.ui.show-stack-traces"; |
156 | 158 |
|
157 | 159 | public static final String METRIC_SERVLETS_CONF_KEY = "hbase.http.metrics.servlets"; |
158 | 160 | public static final String[] METRICS_SERVLETS_DEFAULT = { "jmx", "metrics", "prometheus" }; |
@@ -652,6 +654,14 @@ private void initializeWebServer(String name, String hostName, Configuration con |
652 | 654 | addFilterPathMapping(path, webAppContext); |
653 | 655 | } |
654 | 656 | } |
| 657 | + // Check if disable stack trace property is configured |
| 658 | + if (!conf.getBoolean(HTTP_UI_SHOW_STACKTRACE_KEY, true)) { |
| 659 | + // Disable stack traces for server errors in UI |
| 660 | + webServer.setErrorHandler(new ErrorHandler()); |
| 661 | + webServer.getErrorHandler().setShowStacks(false); |
| 662 | + // Disable stack traces for web app errors in UI |
| 663 | + webAppContext.getErrorHandler().setShowStacks(false); |
| 664 | + } |
655 | 665 | } |
656 | 666 |
|
657 | 667 | private void addManagedListener(ServerConnector connector) { |
|
0 commit comments