YARN-2897. CrossOriginFilter needs more log statements (Mit Desai via jeagles)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/94f3ffeb Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/94f3ffeb Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/94f3ffeb Branch: refs/heads/HDFS-EC Commit: 94f3ffeb6eafc53fc0dee76533e40910d5034f5d Parents: a966dff Author: Jonathan Eagles <jeag...@gmail.com> Authored: Tue Jan 27 16:06:39 2015 -0600 Committer: Zhe Zhang <z...@apache.org> Committed: Thu Jan 29 10:05:24 2015 -0800 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 3 +++ .../server/timeline/webapp/CrossOriginFilter.java | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/94f3ffeb/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 054b394..56ffe97 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -209,6 +209,9 @@ Release 2.7.0 - UNRELEASED YARN-3086. Make NodeManager memory configurable in MiniYARNCluster. (Robert Metzger via ozawa) + YARN-2897. CrossOriginFilter needs more log statements (Mit Desai via + jeagles) + OPTIMIZATIONS BUG FIXES http://git-wip-us.apache.org/repos/asf/hadoop/blob/94f3ffeb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/CrossOriginFilter.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/CrossOriginFilter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/CrossOriginFilter.java index d5fab7a..9edaefb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/CrossOriginFilter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/CrossOriginFilter.java @@ -106,25 +106,43 @@ public class CrossOriginFilter implements Filter { String originsList = encodeHeader(req.getHeader(ORIGIN)); if (!isCrossOrigin(originsList)) { + if(LOG.isDebugEnabled()) { + LOG.debug("Header origin is null. Returning"); + } return; } if (!areOriginsAllowed(originsList)) { + if(LOG.isDebugEnabled()) { + LOG.debug("Header origins '" + originsList + "' not allowed. Returning"); + } return; } String accessControlRequestMethod = req.getHeader(ACCESS_CONTROL_REQUEST_METHOD); if (!isMethodAllowed(accessControlRequestMethod)) { + if(LOG.isDebugEnabled()) { + LOG.debug("Access control method '" + accessControlRequestMethod + + "' not allowed. Returning"); + } return; } String accessControlRequestHeaders = req.getHeader(ACCESS_CONTROL_REQUEST_HEADERS); if (!areHeadersAllowed(accessControlRequestHeaders)) { + if(LOG.isDebugEnabled()) { + LOG.debug("Access control headers '" + accessControlRequestHeaders + + "' not allowed. Returning"); + } return; } + if(LOG.isDebugEnabled()) { + LOG.debug("Completed cross origin filter checks. Populating " + + "HttpServletResponse"); + } res.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, originsList); res.setHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.TRUE.toString()); res.setHeader(ACCESS_CONTROL_ALLOW_METHODS, getAllowedMethodsHeader());