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

fix: dont block corr on empty location host #1135

Merged
merged 6 commits into from
Jan 2, 2020

Conversation

markwolff
Copy link
Contributor

Fixes #1115
Removes unneeded undefined check on this.currentWindowHost before checking if correlation headers should be included on fetch requests

@@ -153,7 +153,7 @@ export class AjaxMonitor implements ITelemetryPlugin, IDependenciesPlugin, IInst
}
return init;
} else if (xhr) { // XHR
if (this.currentWindowHost && CorrelationIdHelper.canIncludeCorrelationHeader(this._config, xhr.ajaxData.getAbsoluteUrl(),
if (CorrelationIdHelper.canIncludeCorrelationHeader(this._config, xhr.ajaxData.getAbsoluteUrl(),
Copy link
Contributor

Choose a reason for hiding this comment

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

If this.currentWindowHost is empty, then canIncludeCorrelationHeader will return false with this check here then this if check is still false correct? Unless requestHost is empty too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I don't think it will affect that check at all unless requestHost is somehow falsy as well. Since it comes from an actual request being made I don't think its possible. From what I can tell, the this.currentWindow host && check isn't actually useful.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I agree to remove it, I mean if the case happens again (this.currentWindowHost is empty), it still can't pass this if check, the logic under if will not run as before. Is that the expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've modified it to not pass the if check anymore unless enableCorsCorrelation is enable and it also passes the included/excluded domains check. I consider an empty currentWindowHost an undefined scenario, so my thought it to always reject it unless the user has opted into a particular CORS correlation scenario.

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.

[BUG] enableCorsCorrelation doesn't work on ionic/cordova app
3 participants