YARN-2897. CrossOriginFilter needs more log statements (Mit Desai via jeagles)
(cherry picked from commit a8ad1e8089
)
This commit is contained in:
parent
3c8d3816c6
commit
c95e8951f8
|
@ -175,6 +175,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
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue