hi i am trying to call ES API from angular JS , but i am getting the error
localhost/:1 Access to XMLHttpRequest at '' from origin 'http://localhost:4200' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
i am running ES cloud 7x version
there is any setting i need to change server side ?
adding my js code also
const userDetails = {
"grant_type": "password",
"username": "***",
"password": "***"
};
let headers = {headers: new HttpHeaders({
'Authorization': "Basic " + btoa('***:***'),
'Content-Type': 'application/json',
// "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
'Access-Control-Allow-Origin': '*'
})};
this.http.post("https:********", userDetails, headers).subscribe(
(val) => {
console.log("POST call successful value returned in body", val);
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
}
Please help me on this .
Thanks