-
Notifications
You must be signed in to change notification settings - Fork 38.6k
SPR-15708 - Add debug logging for CORS rejections #1466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,23 @@ protected boolean handleInternal(ServerHttpRequest request, ServerHttpResponse r | |
List<String> requestHeaders = getHeadersToUse(request, preFlightRequest); | ||
List<String> allowHeaders = checkHeaders(config, requestHeaders); | ||
|
||
if (allowOrigin == null || allowMethods == null || (preFlightRequest && allowHeaders == null)) { | ||
if (allowOrigin == null) { | ||
logger.debug("rejecting request because CORS processor cannot determine " + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about a message like |
||
"request origin"); | ||
rejectRequest(response); | ||
return false; | ||
} | ||
|
||
if (allowMethods == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be moved just bellow |
||
logger.debug("rejecting request because CORS processor cannot determine " + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar remark than for origin for the message |
||
"the allowed methods for the response of a pre-flight request"); | ||
rejectRequest(response); | ||
return false; | ||
} | ||
|
||
if ((preFlightRequest && allowHeaders == null)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be moved just bellow |
||
logger.debug("rejecting request because CORS processor cannot determine " + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar remark than for origin for the message There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not going to get to this any time soon - feel free to reject or do own fix. |
||
"the allowed headers for the response of a pre-flight request"); | ||
rejectRequest(response); | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be moved just bellow
checkOrigin
invocation ?