Response to preflight request doesn't pass access control check: It does not have HTTP ok status

Hello Friends,
I am facing this issue in my ionic 4 application http post request fetch after setting all header parameters.
Access to XMLHttpRequest at ‘https://app.api.in/login’ from origin ‘http://localhost:8100’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.
Thanks

Hi,
I am stuck with pretty much the same issue. I tried using cordova native http and it worked but I want to use the Angular HttpClient. If the native implementation is working for you go ahead I had no problems there.

Hi

CORS is to be resolved through proper setting on the server end.

Zillion articles on this forum and the ionic documentation will explain you

Regards

Tom

Thanks for your comment.
But i don’t have .net knowledge and api have made on .net.
So i is very hard to fixed.
I any way by ionic header but i used all header in ionic.

Wait Did you fix it. And if so what exactly did you do

Did anyone fix it? I pass days trying to solve without success.

I configure the server and I pass header from app ionic to server, but the same issue.

I’m greatfully for a help.

My code.
excluirUsuario(email: any) {

console.log("delete");

const headersJson = new HttpHeaders().set('Content-Type', 'application/json');

let url = "http://localhost/project2MJA/usuarios/excluirUsuario.php"

this.httpClient.request('delete',url,{

  

  headers : headersJson,

  body : "{email : 'suebarth@hotmail.com'}"

})

.subscribe(

          res => {

      // Ok

      alert("ok");

},

err =>

{

      // Error ops 

      alert("erro");  

});

The error:

Access to XMLHttpRequest at ‘http://localhost/project2MJA/usuarios/excluirUsuario.php’ from origin ‘http://localhost:8100’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.

This solution helped me a lot