I have domain sub.example.com
with configured restangular:
RestangularProvider.setDefaultHeaders({
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
});
RestangularProvider.setDefaultHttpFields({
'withCredentials': true
});
Then I'm building other factory via:
return Restangular.withConfig(function(RestangularProvider) {
RestangularProvider.setBaseUrl('http://api.example.com');
});
And, obviously, getting error No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://sub.example.com' is therefore not allowed access.. How should I configure server/client to get working crossdomain requests?
// upd
I'm using Yii on backend and sending next header
header('Access-Control-Allow-Origin: *', true);