Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-Origin Request Blocked: (Reason: CORS header 'Access-Control-Allow-Origin' missing)

I am getting below error in Angularjs

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://.../... (Reason: CORS header 'Access-Control-Allow-Origin' missing).

below is my code:

     $http({
              method: 'GET',
              url:"https://logis../oms/rest/TMS/../listTenders/1.0",

              headers: { 'Authorization': 'Basic Q2FycmllckFUcmFuc01ncjpwYXNzd29yZA=='}
            }).success(function (response) {
                console.log("response--"+response);
              resolve(response);
            }).error(function (error) {
                console.log("error123--"+error)
              reject(error);
            });

I am using GET request in AngularJs and getting above error. So can any one help me if any thing is missing from client side or any thing is remaining from Server Side Server side is written in Java So please help me out. Thanks

like image 598
pareshm Avatar asked Nov 26 '25 22:11

pareshm


1 Answers

I got the same error.. Try calling the url from ur server side language (PHP or NOde)... Youll always get CORS error if u use a client side language(angular or normal AJAX) to call it.

like image 188
Satyam S Avatar answered Nov 29 '25 11:11

Satyam S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!