0

I'm creating a python flask api on remote desktop and running it on localhost of remote desktop. Is there anyway I can access this api from my local machine? We are working in a team and I want to share this with my team members, but this is confidential and not to be deployed on open server. We want to post and get the result with every member's local machine from api runnnig on remote desktop. Both of our local machines and remote desktop are windows10. Sorry for being abstract but I'm searching for any way out. Thanks.

user9191983
  • 505
  • 1
  • 4
  • 20

2 Answers2

2

Well, you should open your way to this API. You'll have to set up a VPN or IP address filter in the server so you can access the server from your network while still have it secured on the Internet. You can also setup a simpler proxy if you prefer it. I'll not cover the details on how to setup a VPN or proxy since it can get pretty extensive, but a Google search will help you out find the best alternative for you.

AFAIK, the Remote Desktop Protocol does not allow for any kind of VPN. However, if you can switch to TeamViewer, it does have an easy to setup VPN system that will allow you to get into the network with few configuration. Once a VPN is configured, it will work like if you were in the same network as the server, so from there you can access your API from your host machine by just going to the IP address of the server.

Do notice the security policies of whoever owns the server, since you can get into trouble if you don't have permission to enable some access from the outside. Security goes always in front of comfort.

Marc Sances
  • 2,402
  • 1
  • 19
  • 34
  • Thanks a lot! I'm sorry I'm very new to this kind of thing, and is it still possible to curl localhost of remote desktop through proxy? – user9191983 May 30 '19 at 07:07
  • Yes, check out this answer: https://stackoverflow.com/questions/9445489/performing-http-requests-with-curl-using-proxy – Marc Sances May 30 '19 at 07:25
1

Short term solution:

Firstly download ngrok for your operating system.

For debugging and testing purposes you can expose a secure tunnel connection to your API by running this command in your command prompt / terminal.

ngrok http <PORT_NUMBER>-host-header="localhost:<PORT_NUMBER>"

Where PORT_NUMBER is the port number in which your flask application is running.

Example if your flask application is running at port 5000 then simply execute this command:

ngrok http 5000 -host-header="localhost:5000"

Running this will give you two hostnames one with HTTP and other a secure HTTPS connected by a tunnel like this for a duration of 8 hours after which the command needs to again re-run.

enter image description here

Which you can call remotely


Long term solution:

Deploy flask application using FastCGI

or

To a cloud infrastructure provider like Microsoft Azure which gives readymade templates for flask applications.

Kunal Mukherjee
  • 5,775
  • 3
  • 25
  • 53
  • interesting. thank you. But it doesn't seem it works fine. I posted another further question, hope you could answer me again. https://stackoverflow.com/questions/56374118/ngrok-doesnt-work-in-some-particular-case – user9191983 May 30 '19 at 08:01
  • Ok now I know your answer doesn't get my point. I dont want my code anywhere out if internal network...it users external server anyways...doesnt work. – user9191983 May 31 '19 at 04:09