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

Don't add X-CSRF-Token if request is cross domain #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bwittenbrook3
Copy link

@bwittenbrook3 bwittenbrook3 commented Jul 12, 2016

Since there is no way to remove an element from the Access-Control-Request-Headers after you set the request header on the xhr object, we need to add in a check to not set the X-CSRF-Token when performing a cross domain request.

With this change, you can set the crossDomain: true property (as below) of an ajax call and it will not include the X-CSRF-Token, which would otherwise fail during the preflight response in applications that do not support that token as indicated by the Access-Control-Allow-Headers of their response.

$.ajax({
      ...
      crossDomain: true,
});

@freundchen
Copy link

+1
Will this be merged anytime?

@sansb
Copy link

sansb commented Nov 21, 2018

@rondale-sc please merge

sansb pushed a commit to amitree/ember-cli-rails-addon that referenced this pull request Nov 21, 2018
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