0

I am able to make REST API call using Postman/browser by passing Authorization token. However when I make the same call using AngularJS it's getting errored out. It's returning net::ERR_INSECURE_RESPONSE

I would like to know what can be possibly causing this error and how to fix this.

$http.get('https://hostname:8443/medrecdb-records', {
    headers: { 
    'Authorization': 'Basic YWRtaW46UGFzc3dvcmQx' }})
   .then(function (response) { 
       $scope.drug = response.data;
       console.log("Response is: " + response); 
 }).catch(function (response) {
        // Handle error
        var data = response.data;
        var status = response.status;
        var statusText = response.statusText;
        var headers = response.headers;
        var config = response.config;
        console.log("Response data is: " + data);
    });
  • try with this https://stackoverflow.com/questions/37355890/neterr-insecure-response-in-chrome – Manoj Patidar Sep 19 '17 at 07:40
  • Thanks for suggesting the link. It doesn't though have any specific answer related to my query. The call does happen but it seems the authorization header is not getting passed. Not sure if there is any syntax/semantic issue. After making the HTTP GET call it goes to catch block where response data is null. – Ashutosh Satyam Sep 19 '17 at 08:01
  • Please check with you server it support browser OPTION request ? – Manoj Patidar Sep 19 '17 at 08:05
  • For Angular $http service does the server need to support OPTION request? I am assuming this is not required if request is being made through browser. Any additional header to be passed from client to make this work – Ashutosh Satyam Sep 19 '17 at 08:44
  • Yes , server need to support OPTION request. no additional header to be passed from client side. – Manoj Patidar Sep 19 '17 at 08:57

0 Answers0