Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Did you open the port in the firewall? –  Michael Hampton Sep 3 '13 at 6:56
2  
Change it to run on 10.86.29.23:5000 or 0.0.0.0:5000 (wildcard) instead of 127.0.0.1:5000. –  David Schwartz Sep 3 '13 at 6:59

2 Answers 2

up vote 5 down vote accepted

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)

share|improve this answer
    
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 '13 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 '13 at 9:41

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 youusername@10.86.29.23 -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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.