Skip to content

Conversation

@shorn
Copy link

@shorn shorn commented Jun 28, 2017

Issue: SPR-15708
I have submitted the ICLA.

@snicoll snicoll changed the title Add debug logging for CORS rejections SPR-15708 - Add debug logging for CORS rejections Jun 28, 2017
Copy link
Contributor

@sdeleuze sdeleuze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, could you have a look to my remarks and force push an updated commit.

List<String> allowHeaders = checkHeaders(config, requestHeaders);

if (allowOrigin == null || allowMethods == null || (preFlightRequest && allowHeaders == null)) {
if (allowOrigin == null) {
Copy link
Contributor

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 ?

return false;
}

if (allowMethods == null) {
Copy link
Contributor

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 checkMethods invocation ?

return false;
}

if ((preFlightRequest && allowHeaders == null)) {
Copy link
Contributor

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 checkHeaders invocation ?


if (allowOrigin == null || allowMethods == null || (preFlightRequest && allowHeaders == null)) {
if (allowOrigin == null) {
logger.debug("rejecting request because CORS processor cannot determine " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a message like "Rejecting CORS request because '" + requestOrigin + "' origin is not allowed"

}

if (allowMethods == null) {
logger.debug("rejecting request because CORS processor cannot determine " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar remark than for origin for the message

}

if ((preFlightRequest && allowHeaders == null)) {
logger.debug("rejecting request because CORS processor cannot determine " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar remark than for origin for the message

Copy link
Author

Choose a reason for hiding this comment

The 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.

@sdeleuze
Copy link
Contributor

sdeleuze commented Jul 3, 2017

Fixed via 9901c38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants