In my Rails app i have an action that make ajax request. When i make this ajax request, Setting CSRF token with xhr.setRequestHeader works fine in development but in production (heroku) doesn’t. What could be possibly a problem? or how do i debug thisin firebug?
Here is my ajax setup
jQuery.ajaxSetup({
'beforeSend': function(xhr, settings) {
xhr.setRequestHeader("Accept", "application/json");
var token=$('meta[name="csrf-token"]').attr('content');
xhr.setRequestHeader('X-CSRF-Token',token );
settings['dataType'] = "json";
settings['contentType'] = "application/json";
}
});
Finally i figured it out, for this to work in production i had to configure the production domain in
session_store.rbas follows