0

I am trying to write a method which going to check whether the URL is correct or not. For that, I have written a method in Angular like below.

checkUrlValidation(url){
  return this.http.get(url,{withCredentials:true})
  .pipe(catchError((error)=>{
    return new Promise((resolve,reject)=>{
      console.log("HAHAHAHAHAHHAH")
      if(error.status == 200){
        resolve(true);
      }else{
        reject(false);
      }
    });
  }));
}

And When i call this method i will get following error:

Access to XMLHttpRequest at 'https://coreui.io/docs/components/forms/' from origin 'http://localhost:4200' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Any help would be highly appreciated.

Ravi Sapariya
  • 395
  • 2
  • 11
  • look into this https://stackoverflow.com/questions/42803394/cors-credentials-mode-is-include – Allabakash Nov 26 '19 at 16:11
  • https://stackoverflow.com/questions/43114750/header-in-the-response-must-not-be-the-wildcard-when-the-requests-credentia – Allabakash Nov 26 '19 at 16:11
  • The above links will not work for me, because I have no control on the server.User has the flexibility to write any URL across the web. I just wanted to hit that page and if i will receive 200 in that case URL will be valid. – Ravi Sapariya Nov 26 '19 at 16:24

0 Answers0