I have apache2 server to serve the frontend angular on localhost:80 and 
Flask API on localhost:5000.

When I do:

* $http.get('http://localhost:5000/listtigroups') *

from angular code. I get:

*Failed to load resource: http://localhost:5000/listtigroups 
<http://localhost:5000/listtigroups>net::ERR_CONNECTION_REFUSED*
(I am using chrome)

Also, the status code from the response is -1, which means it does not even 
hit the server.
And using 127.0.0.1 instead of localhost gives same result.

However, if instead of local host I put the machine's ip address, 
everything works perfect:
*$http.get('http://192.168.1.90:5000/listtigroups') *

Also, if I just do on that machine (which is a Ubuntu VM):

*root@xxx> wget http://localhost:5000*

*--2016-06-03 21:21:43--  http://localhost:5000/*
*Resolving localhost (localhost)... ::1, 127.0.0.1*
*Connecting to localhost (localhost)|::1|:5000... connected.*
*HTTP request sent, awaiting response... 404 NOT FOUND*
*2016-06-03 21:21:43 ERROR 404: NOT FOUND.*

So the system knows how to interpret localhost correctly.

It does not look like a CORS issue either, since: 1. I get a response -1 
(i.e. did not hit the server) and 2. if I use host address instead of 
localhost everything works.

So, is it angular/JS bug or why is that happening? 

Thanks.


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to