1

I'm trying to run a simple flask server on an Ubuntu VM.

I can ssh into it,with [email protected], but if I execute curl 123.456.789:8000 I get an operation timeout, even though the server is listening:

 * Serving Flask app "app.py"                        
 * Environment: production                                                        
   WARNING: This is a development server. Do not use it in a production deployment.                  
   Use a production WSGI server instead.                 
 * Debug mode: off                                                                   
 * Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)

My iptables -vnL output looks like this:

Chain INPUT (policy ACCEPT 11434 packets, 8571K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8000

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 7590 packets, 4856K bytes)
 pkts bytes target     prot opt in     out     source               destination

so port 8000 should be good to go. On lsof I can see it as well:

flask     16268           robin    3u  IPv4 167958      0t0  TCP 127.0.0.1:8000 (LISTEN)

I haven't really done that before, so it might be a stupid mistake, but can you think of anything else that might be wrong here?

1 Answer 1

0

The python/flask app is listening on 127.0.0.1, hence limiting access to localhost.

Make it listen on the specific IP or 0.0.0.0, depending on what you need.

1
  • Thanks for your help! I changed the IP manually to 0.0.0.0, so now it's listening on http://0.0.0.0:8000/. The requests to the IP of the machine still time out now :/ Could there be something else?
    – Robinbux
    Commented Mar 24, 2020 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .