DEV Community

Sospeter Mong'are
Sospeter Mong'are

Posted on • Edited on

2

Exposing a local web app to the world using LocalTunnel

Exposing a local web app to the world using LocalTunnel is straightforward. Follow these steps:

1. Install LocalTunnel

You need Node.js installed on your system to use LocalTunnel. If Node.js is not installed, download it from Node.js official site.

Once Node.js is installed, use the following command to install LocalTunnel globally:

npm install -g localtunnel
Enter fullscreen mode Exit fullscreen mode

2. Run Your Local Web App

Start the web app you want to expose. For example, if it's running on port 8000:

npm start
Enter fullscreen mode Exit fullscreen mode

or

python -m http.server 8000
Enter fullscreen mode Exit fullscreen mode

3. Expose Your App Using LocalTunnel

Run the following command, replacing 8000 with your web app's port:

lt --port 8000
Enter fullscreen mode Exit fullscreen mode

4. Access the Public URL

After running the command, LocalTunnel will provide a URL like this:

https://your-app-name.loca.lt
Enter fullscreen mode Exit fullscreen mode

Random Url

Share this URL with others, and they can access your app.

5. Customize the Subdomain (Optional)

You can specify a custom subdomain:

lt --port 8000 --subdomain mycustomapp
Enter fullscreen mode Exit fullscreen mode

If the subdomain is available, your app will be accessible at:

https://mycustomapp.loca.lt
Enter fullscreen mode Exit fullscreen mode

6. Handle Security

  • Since LocalTunnel exposes your app publicly, be cautious about sensitive data.
  • Avoid running production apps with LocalTunnel.
  • Consider using HTTPS by default for secure communication.

7. Stop LocalTunnel

To stop the LocalTunnel, press Ctrl + C in the terminal running the command.

Now your local web app is accessible to the world temporarily via the LocalTunnel URL!

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay