javascript - Http request through a proxy server using angular js -


is possible call web service though proxy server using angular $http? webservices hosted in server , have proxy server possible can redirect request through proxy not changing device property through code?

$http({     method: $scope.method,     url: $scope.url,     params: { "member_id": "998014437" }     })     .then(function (response) {         $scope.status = response.status,         $scope.data = response.data;     }, function (response) {         $scope.data = response.data || "request failed";         $scope.status = response.status;     } );  

as far know there aren't build in webproxy settings xmlhttprequest, there aren't angular $http too. common practice using proxy on matter build server side proxy page on domain. like:

"/proxy.php?url=http://crossdomain.com/somedata.json"

this page make web requests on server side , return same response client headers , everything. , make requests via proxy page. since proxy url part @ beginning of actual url, can customize variable url: proxyprefix + $scope.url . if proxy prefix variable empty, request done on actual server.


Comments