I have a problem with CORS, the problem is my code is executed (status 200) but I have an error in Google Chrome developer console.
My code:
function callUrl(url) {
var xmlhttp = null;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp !== null) {
xmlhttp.open("POST", url, true);
xmlhttp.withCredentials = true;
xmlhttp.send(JSON.stringify({
}));
} else {
console.error("Your browser does not support XMLHTTP.");
}
}
callUrl('https://www.website.com/tracking?etc...');
XMLHttpRequest cannot load https://www.website.com/tracking?. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:8888' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
The server configuration:
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true,