I make request from my localhost(gulp server) to example domain in to VerifyPassword controller. When i make request without headers: {'X-Requested-With': 'XMLHttpRequest'}
, It comes as expected 400 Bad request
$.ajax({
url: 'http://example/index.php/actions/users/verifyPassword',
type: 'POST',
data: $data,
xhrFields: {
withCredentials: true
},
success(data, response) {
console.log(data, response);
},
error(data, response) {
console.log(response, data);
}
});
When i make request with headers: {'X-Requested-With': 'XMLHttpRequest'}
comes response XMLHttpRequest cannot load http://example/index.php/actions/users/verifyPassword. Response for preflight is invalid (redirect)
, and are not sent cookies. Done OPTIONS preflight request without cookies and server comes 302 and redirect to example/login
.
How To be?
http://www.yiiframework.com/forum/index.php?/topic/4945-yiiapp-request-isajaxrequest/
crossDomain: true,
as well