Hi
I’m trying to do a cross domain odata request.
I have a node.js application that runs on port 9000 that calls the odata api with
$.ajax({
url : 'http://localhost:8099/odata/TCCLIENTS',
dataType : "json",
xhrFields: {
withCredentials: true
},
success : function(d){
console.log(d);
}
});
But I get this error :
XMLHttpRequest cannot load http://localhost:8099/odata/TCCLIENTS. Credentials flag is 'true', but the 'Access-Control-Allow-Credentials' header is ''. It must be 'true' to allow credentials. Origin 'http://localhost:9000' is therefore not allowed access.
I’ve set the server event OnSendCrossOriginHeader
procedure TServerDataModule.ServerSendCrossOriginHeader(var AllowedOrigin:
string);
begin
AllowedOrigin := 'http://localhost:9000';
end;
How can I set the value of the ‘Access-Control-Allow-Credentials’ to true ?