How do I allow a remote user to connect to a web app running on my PC?

33,266

Solution 1

Connecting from the same LAN

If your friend is on the same local network as you, it's very simple: make sure any software firewalls on your computer are configured to accept connections from remote computers on port 8080, then have your friend replace "localhost" in your URL with your IP address or hostname--for instance, http://192.168.1.4:8080/LimsWeb (assuming that is your IP address) or http://lims-pc:8080/LimsWeb.

Connecting over the Internet

But suppose your friend is somewhere else, and the Internet lies between you and him...then you have to do a little extra. You'll have to configure your firewall software just as you did for the LAN instructions, but you'll also need to do some additional network configuration.

Option 1: VPN

If you only want your friend to be able to connect to the web service running on your PC, the easiest solution is probably to set up a VPN. Some wireless routers have VPN support built-in (and with some others, you can install a version of DD-WRT with VPN support), but you can also use something like Hamachi or OpenVPN.

Option 2: Port forwarding/DMZ

If you have administrative privileges on your router (or know someone who does), you can also configure port forwarding or (even scarier) DMZ to allow outside computers to connect directly to your PC. As alemjerus mentioned, you can also set up a dynamic DNS service or some other DNS provider (e.g., dyndns.org, no-ip.com) to point to your Internet IP, so your friend can connect more easily without having to remember your IP address. But personally, I wouldn't recommend going this route, especially not if you happen to be in a corporate environment.

Using the right hostname/IP address

But that's only half of it. As you might have already guessed, your friend won't be able to connect to your computer via the address http://localhost:8080/LimsWeb, because "localhost" is exactly that--the local computer. Once you settle on an appropriate mechanism to make your computer visible to his, he'll have to use your LAN IP address or hostname (if you used a VPN) or your public IP address or hostname on the Internet (if you used port forwarding or DMZ).

Solution 2

There are many methods to do this - the difference is security, easiness of the configuration and cost of the solution.

I will add one more option for this (port forwarding and VPN are described above)

Tunneling - this will allow to securely tunnel to your database and your web server (https:// enabled) whenever you want! For this you can use free tunneling services TunnelIn or Ngrok . The process of both services are very straight forward i.e. Register a User, Connect your machine/device to service, use Web interface to open/close secure tunnels to the machine in case of TunnelIn or run couple of commands for Ngrok.

Share:
33,266

Related videos on Youtube

Robin Agrahari
Author by

Robin Agrahari

Working as a Cognos Reports and Datawarehouse Developer in Software Industry since 3 years. I also like working in asp.net and I love to create websites. My hobbies are music, painting and teaching.

Updated on September 17, 2022

Comments

  • Robin Agrahari
    Robin Agrahari almost 2 years

    I have created a web application in Eclipse, and a DB2 database server is running on my PC. I can access the web application through the address http://localhost:8080/LimsWeb

    I used Team Viewer software to establish a remote desktop connection.

    Can my friend somehow connect to my PC so that when he types the above URL in his browser he will be able to fetch the pages of the application?

    I was able to do this by connecting with remote desktop mode. But in that case my friend was able to use the application which I created running on my PC only and in the window provided by Team Viewer. I want to configure it so that he can run the application on his own computer calling the given URL from his own browser.

    • Admin
      Admin almost 14 years
      This isn't really a remote desktop question--it's actually more of a general networking question.
    • Admin
      Admin almost 14 years
      Just following up...have you had any luck getting it to work?
  • Admin
    Admin over 14 years
    how to deploy the project on web.the database server is on my pc only
  • rob
    rob almost 14 years
    @robin: you would have to move the database to the hosted server, as well.