Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71530

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

$
0
0

@sridharan31 wrote:

Ionic 4 project HTTP request I got an error

Access to XMLHttpRequest at ‘https://u*****test.f****t.co.in/getMccList’ 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'})};

  return this.http.post(this.URL+methodname,request,httpOptions).pipe(
    catchError(this.handleError)
  );
  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71530

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>