AngularJS - Request timeout although resource exists -
i've created web application on raspberry pi, 1 have http requests gateway (the gateway , raspberry pi on same network). http requests made in angular, that:
$http.get("http://192.168.3.9:8081/command=get?token").success(function(data){ console.log("token is: "+data); }).error(function(data, status, headers, config){ console.log("unable find token"); console.log(data); console.log(status); console.log(headers); console.log(config); });
now here there's problem, expected either have response or have error cors instead receive error says me requests ended due timeout.
not possible because request url absolutely correct. how solve problem?
p.s.: information useful: gateway , raspberry pi in home network, connect pc raspberry office network.
the issue here have $http.get
running in client's browser.
therefore have 2 separate problems - need able resolve ip address/url, , need port number reach host.
the 192.168... address lan ip, makes sense within home network. port 8081 need able reach rpi through gateway once fix ip/url issue.
you've not made full infrastructure clear - if rpi whole server side infrastructure (ie there isn't separate webserver), need either have static wan ip home network, or configure host name gets updated dynamic ip (see ddclient or similar).
if have separate webserver you're able reach ok, consider having controller in main website bounces these requests on rpi. add little overhead, has various configuration advantages - eliminates cors, don't need rpi exposes web etc etc.