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

[v1.4.1] Webpack with CORS #12

Closed
zallek opened this issue Feb 22, 2016 · 2 comments
Closed

[v1.4.1] Webpack with CORS #12

zallek opened this issue Feb 22, 2016 · 2 comments

Comments

@zallek
Copy link

zallek commented Feb 22, 2016

When the fetched URL exposes the CORS header 'Access-Control-Allow-Origin': '*', the request fails.

A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true.

Webpack is using this lib as a http module https://github.com/substack/http-browserify. And for some reason, the lib set by default xhr.withCredentials to true.

Adding withCredentials: false on params given to http module solves the issue https://github.com/BigstickCarpet/json-schema-ref-parser/blob/v1.4.1/lib/read.js#L176

var req = protocol.get(
  {
    hostname: u.hostname,
    port: u.port,
    path: u.path,
    auth: u.auth,
    withCredentials: false,
  },
  onResponse
);
@zallek
Copy link
Author

zallek commented Feb 22, 2016

I created a branch on my fork https://github.com/zallek/json-schema-ref-parser/tree/bugfix/cors-webpack
commit: zallek@32c1179

But I can't create PR for your repo because I need a target branch based on v1.4.1 tag.

@JamesMessinger
Copy link
Member

This issue is fixed in newer versions of the library. Please upgrade to the latest version, which includes many critical bug fixes, as well as many new features.

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

No branches or pull requests

2 participants