Can't access to the API on remote host

Create issue
Issue #20 resolved
Lamjed Ben Jabeur created an issue

I have started the API on my ec2 instance

#!shell
$ ./bin/api -c config/livinglabs.local.ini
 * Living Labs Challenge's API Server
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader
 * Living Labs Challenge's API Server

The API server is accesible from local host using curl command

#!shell
$ curl http://127.0.0.1:5000/api/participant/query/unkown
{
    "message": "No such user. See http://doc.living-labs.net/."
}

Until this step, every thing was fine. However, when I try to access to the API from a remote server I got the this error

#!shell

$ curl http://[my_ec2_public_ip]:5000/api/participant/query/unkown
curl: (7) Failed to connect to [my_ec2_public_ip] port 5000: Connection refused
I have already cheked that port 5000 is not blocked by the firewall.

Comments (2)

  1. Lamjed Ben Jabeur reporter

    Flask server is only accessible on deploying host, not from any other in the network.. You can make the server publicly available simply by changing the host from '127.0.0.0' to '0.0.0.0'

    #!python
    [api]
    host = '0.0.0.0'
    port = 5000
    
  2. Log in to comment