YARN-2897. CrossOriginFilter needs more log statements (Mit Desai via jeagles)

This commit is contained in:
Jonathan Eagles 2015-01-27 16:06:39 -06:00
parent 8bf6f0b703
commit a8ad1e8089
2 changed files with 21 additions and 0 deletions

View File

@ -209,6 +209,9 @@ Release 2.7.0 - UNRELEASED
YARN-3086. Make NodeManager memory configurable in MiniYARNCluster. YARN-3086. Make NodeManager memory configurable in MiniYARNCluster.
(Robert Metzger via ozawa) (Robert Metzger via ozawa)
YARN-2897. CrossOriginFilter needs more log statements (Mit Desai via
jeagles)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -106,25 +106,43 @@ public class CrossOriginFilter implements Filter {
String originsList = encodeHeader(req.getHeader(ORIGIN)); String originsList = encodeHeader(req.getHeader(ORIGIN));
if (!isCrossOrigin(originsList)) { if (!isCrossOrigin(originsList)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Header origin is null. Returning");
}
return; return;
} }
if (!areOriginsAllowed(originsList)) { if (!areOriginsAllowed(originsList)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Header origins '" + originsList + "' not allowed. Returning");
}
return; return;
} }
String accessControlRequestMethod = String accessControlRequestMethod =
req.getHeader(ACCESS_CONTROL_REQUEST_METHOD); req.getHeader(ACCESS_CONTROL_REQUEST_METHOD);
if (!isMethodAllowed(accessControlRequestMethod)) { if (!isMethodAllowed(accessControlRequestMethod)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Access control method '" + accessControlRequestMethod +
"' not allowed. Returning");
}
return; return;
} }
String accessControlRequestHeaders = String accessControlRequestHeaders =
req.getHeader(ACCESS_CONTROL_REQUEST_HEADERS); req.getHeader(ACCESS_CONTROL_REQUEST_HEADERS);
if (!areHeadersAllowed(accessControlRequestHeaders)) { if (!areHeadersAllowed(accessControlRequestHeaders)) {
if(LOG.isDebugEnabled()) {
LOG.debug("Access control headers '" + accessControlRequestHeaders +
"' not allowed. Returning");
}
return; 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_ORIGIN, originsList);
res.setHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.TRUE.toString()); res.setHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.TRUE.toString());
res.setHeader(ACCESS_CONTROL_ALLOW_METHODS, getAllowedMethodsHeader()); res.setHeader(ACCESS_CONTROL_ALLOW_METHODS, getAllowedMethodsHeader());