Connection refused when I made a request $ http Post with angular JS

0

I have an application using Angular JS. At the time of making a request to the backend that I have in PHP. It throws me the following error.

The error only appears when I use the application from another device that is not the server.

To make the request, I use the following method:

			utils.getHttp = function (getAuth, getUrl, getData){ // Boleano, si necesita autorizacion, URL de la peticion, y un objeto con los datos.
return $http({
  method: 'POST',
  skipAuthorization: getAuth,
  url: getUrl,
  data: getData,
  headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function successCallback(response) {
  //console.log(response);
    if ('error' in response.data) {
    return $q.reject(response);
  }
  return response;
}).catch(function errorCallback(response) {
  console.error(response);
  return $q.reject(response.data);
});
}
    
asked by Hiram Hernandez 10.07.2017 в 18:23
source

1 answer

0

The url says localhost , you would have to change that for the public ip address or the intranet if that were the case.

You can only access localhost from the server itself.

    
answered by 10.07.2017 / 18:34
source