Access to XMLHttpRequest at<URL> from origin 'http://localhost' has been blocked by CORS policy Ionic 4

Ionic 4 project HTTP request I got an error

Access to XMLHttpRequest at ‘https://u*****test.f****’ from origin ‘http://localhost’ 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 have added plugin cordova-plugin-whitelist

added chrome extension i run this app in android device and debug i chrome browser

this is my server HTTP request call

callserver(methodname, metadata, metainfo){
    var TIMEOUT_REQUEST =10;

  var request = {
    "MetaData": metadata,
    "MetaInfo": metainfo
  const httpOptions = {headers: new HttpHeaders({'Content-Type': 'application/json'})};


Did you install this one in Chrome?

1 Like

Hi @sridharan31 :wave:

Installing a Chrome extension won’t fix your CORS issues in other devices other than your own, that’s why it isn’t working on the Android device.

Please check the CORS Errors page in the Ionic documentation with different solutions depending on your situation.


1 Like

@sridharan31 @FdezRomero Did you get any solution for this?