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

Add withCredentials option. Fix #29 #33

Merged
merged 2 commits into from
Jul 1, 2014

Conversation

gsf
Copy link
Collaborator

@gsf gsf commented Jul 1, 2014

No description provided.

if (options.cors) {
xhr.withCredentials = true

if ("withCredentials" in options) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we default it to true.

We can use if (options.withCredentials !== false) { ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh that would be bad actually. What we want is

if (options.cors && options.withCredentials !== false) {

Meaning opt into cors & opt out of withCredentials

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See browserify/http-browserify#47, which I mentioned in #29. The spec says withCredentials should default to false, so that's what people expect. Also, the wildcard is not allowed in Access-Control-Allow-Origin when it's set to true.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The spec says withCredentials should default to false, so that's what people expect

The spec has an annoying default, xhr defaults to true because that's what you want. Also I don't think breaking back compat is a good idea. Note that it should still be optin by setting cors to true, so it DOES default to false

Also, the wildcard is not allowed in Access-Control-Allow-Origin when it's set to true.

The wildcard was always a bad idea, no production service should be using it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, I wasn't aware of the best practice there, and I imagine I'm not the only one. Maybe worth a word in the README? Do you have any good resources around this issue to point at?

In the meantime I'll change it to default to true.

Raynos added a commit that referenced this pull request Jul 1, 2014
@Raynos Raynos merged commit 58e4e30 into naugtur:master Jul 1, 2014
@Raynos
Copy link
Collaborator

Raynos commented Jul 1, 2014

Published v1.12.0

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