I'm working on my desktop computer. On this machine I also run Tomcat for my Java development so that I can visit my local address:

Now I go to whatsmyip.com and get my IP lets say it is:

Now what I want is that: I go to another PC (not on my LAN) or any PC around the world connected to Internet and type the following address:


this should show me the same page that I can access locally from http://

Is this possible?

  • 2
    Yes it's possibile, did you tried it?
    – Atropo
    Dec 28, 2012 at 12:03

5 Answers 5


Yes, it is possible. It is called "Port Forwarding". - is your public IP address. - is your private IP address on the LAN.

To see how port forwarding is done read this very good and short tutorial with lots of nice pictures:
How to Forward Ports on Your Router


You need to do forward your 8080 port through your router.

If your IP changes (you have a dynamic IP or a static IP, this is determined by your ISP) you can get a host name from dyndns and set up your router to update dyndns with your new IP when it changes. this will allow you to access your application like so:


Alternatively, you can rent a hosted server and a domain name.


If it is for short term, you can use localtunnel (same like ngrok).

Just follow these steps (require: NodeJS):

  1. Install localtunnel by running

    npm install -g localtunnel
  2. Assumes, your app is running on http://localhost:8080/, then run

    lt --port 8080

    It will create a public url domain with a random name like this.

Note: You can create custom url as well (eg: lt --port 4200 -s "sangeeth", -s means subdomain).

Ta-da! It's done!

  • Cool! But what if my local address is can I still use lt? Sep 21, 2022 at 21:21
  • visitors have to enter password which I should provide, not convenient for testing webhooks
    – temirbek
    Feb 27 at 6:12

Similar to @KernelMode answer, using ngrok but if you are on a macOS, open a terminal to the directory you downloaded ngrok and type ./ngrok http 8080 this will give you a http and a https public URL that you can use to access your localhost from other machines:

enter image description here

Below is a brief info about ngrok and things it can do with examples:

enter image description here

Note: if you want to access a particular link in your local server, no need to pass that as a command parameter in the terminal, once URL is assigned just append the sub-section to the URL.

For example: Assigned URL: http://1234567890.ngork.io and section you want to access: http://1234567890.ngork.io/myAppSub-section

  1. Download ngrok.
  2. Run your service.
  3. Assuming your tomcat server listen on port 8080, run ngrok in command line with this command:

ngrok.exe http 8080

ngrok starts port forwarding and it looks like this:

enter image description here

Now, the client can run request with the url http://a9bb8562.ngrok.io/myapp.

  • is ngrok able to handle production traffic? let say handling concurrent request before tunneling it to our network Mar 30, 2020 at 15:10
  • 2
    I don't use this approach for production, only temporary for POC. In my example, it is just a local executable that is not managed, has no scale and no resiliency, so I don't think you should use it as-is for production.
    – elirandav
    Apr 1, 2020 at 6:31
  • 1
    Do not use this approach for production. This is only for local server testing on your own private machine. If you need to do this for production you need to use a DNS server like Cloudflare or whatever other services you prefer.
    – Hassen Ch.
    May 4, 2020 at 14:38

You must log in to answer this question.

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