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 CORS error when using library with Browserify #213

Merged
merged 1 commit into from
Mar 28, 2017

Conversation

debugthings
Copy link
Contributor

Customers are starting to use the AppInsights node.js SDK to develop browser applications thanks to browserify. This creates a shim for any http.request and https.request call so it redirects to XMLHttpRequest. Unforutnately, this shim defaults to setting withCredentials.

This specific setting does not like the wildcard value for the Access-Control-Allow-Origin header.

Browserify code that causes the problem, that has not been fixed for about 2.5 years now.

Recommended that we add an explicit withCredentials = false in the sender library to avoid these exceptions.

XMLHttpRequest cannot load https://dc.services.visualstudio.com/v2/track. 
Response to preflight request doesn't pass access control check: The value of the 
'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the 
request's credentials mode is 'include'. Origin 'https://YOURSERVER.ADDRESS.COM/' is therefore 
not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is 
controlled by the withCredentials attribute.

Fixes an obscure problem when trying to use the ApplicationInsights node.js library with a browserify application.
@msftclas
Copy link

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@KamilSzostak KamilSzostak added this to the 0.20.0 milestone Mar 28, 2017
@KamilSzostak KamilSzostak merged commit 060130b into microsoft:develop Mar 28, 2017
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.

3 participants