I read a lot of preflight and CORS answers, so please do not post links that link to what I should read. Many of the answers relate to the server perspective, but I am the client in this case. Set source header? My assumption is that this is a simple request, am I right?
req.open("POST", url, true);
req.setRequestHeader( 'Content-Type', 'application/blahblah' );
req.setRequestHeader( 'Accept', 'application/blahblah' );
req.setRequestHeader("Authorization", "Basic " + btoa(user + ":" + pass));
req.send();
But it still does not work, my mistake is:
The response to the preflight check request does not pass the access control check. There is no "Access-Control-Allow-Origin" header on the requested resource. Therefore, the original 'null' is not allowed. The response was an HTTP status code of 500.
source
share