1

I have a server say 10.xx.xx.xx and I have deployed a flask application and it runs on 127.0.0.1:5000/. I am doing this by logging in using putty through a windows machine. So how do I access the flask app through my windows machine? I tried serverIP:5000 but it doesn't work.

It says Oops! Google Chrome could not connect to serverip:5000. Do I need to edit some config file somewhere.?

Thanks.

2

2 Answers 2

8

If you application is listening on 127.0.0.1:5000 then you can only reach it locally and through that address.

Edit: To be more specific:

  • You cannot reach the application from a remote network machine.
  • You cannot reach the application using a local process that tries to connect to any local IP except the loopback address (127.0.0.1)

To change this, you have to have the application either bind on all local IP (0.0.0.0) or to a specific local IP (10.86.29.23)

2
  • 1
    Thanks.You pointed me in the right direction by telling to bind it to a different address. app.run(host="0.0.0.0") did it.
    – Sankalp
    Sep 3, 2013 at 7:14
  • @Sankalp Just so you know, binding to 0.0.0.0 generally means "Listen on all addresses". This may or may not be what you want in future.
    – Dan
    Sep 4, 2013 at 9:41
0

If you run your app on localhost on purpose (some security issue) you can reach it only from computer that is app is installed on. There is other way to reach it from other pcs... if this app run on your centos machine you can connect to this app via ssh tunnel and proxy. I'ts quite easy of course if you have ssh configured on server.

From linux machine you can do this by executing:

ssh [email protected] -D 8080

Then configure you internet browser to use socks proxy on localhost:8080 (This way every connection will be visible for this app on port 5000 as it would be from local machine).

For windows you must use putty to make a ssh tunnel and then configure your proxy in browser

You must log in to answer this question.

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