Skip to content
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

SPR-15708 - Add debug logging for CORS rejections #1466

Closed
wants to merge 1 commit into from
Closed

SPR-15708 - Add debug logging for CORS rejections #1466

wants to merge 1 commit into from

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.

@@ -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) {
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 ?

@@ -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 " +
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