I have 2 applications:
1) a Rest API on an XPTO server (using laravel 5.1), which has:
->header('Access-Control-Allow-Origin', '*.xpto.com.br')
->header('Access-Control-Allow-Credentials', 'true')
->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE')
->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Content-Range, Content-Disposition, Content-Description');
2) In my static Client: Front that makes AJAX GET / POST / PUT / DELETE for the API above.
GET / POST happens normal, but when I do a PUT / DELETE it returns:
"Access-Control-Allow-Origin" header is present on the requested resource "
What does not make sense, because if it did not have Origin, neither POST would work.
Method I use:
var objXPTO = function() {
...
this.Ajax = function(url,type,args,callback) {
//console.log(url,type,args,callback);
$.ajax({
url: url,
method: type,
data: args
}).done(function(data) {
callback(data);
});
}
...
}
Is there any light?