npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

localtunnel-plus

v2.1.1

Published

Expose localhost to the world

Readme

localtunnel

Version 2.1.1 - Now with WORKING keep-alive mode!

localtunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.

Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.

⚡ What's New

v2.1.1 (Latest) - Critical Keep-Alive Fixes

  • 🐛 FIXED: Keep-alive now actually works (pipes with { end: false })
  • 🐛 FIXED: Deprecated url.parse() warning removed
  • Unlimited requests with --keep-alive flag
  • Testing guide added (TESTING_KEEPALIVE.md)

v2.1.0 - Major Security & Features

  • Security: Updated all dependencies, fixed critical axios vulnerability
  • Documentation: Comprehensive JSDoc, security analysis, and troubleshooting guides
  • Persistent Connections: Experimental --keep-alive mode to prevent socket exhaustion
  • Better Errors: Improved error messages and debugging output
  • TCP Keep-Alive: Automatic detection of broken connections

⚠️ Important Notes

Socket Exhaustion Issue

The standard client closes tunnel sockets after each request, which can cause the tunnel to become unavailable after N requests (where N = max_conn_count from server).

Solutions:

  1. ✅ Use --keep-alive flag (now working in v2.1.1!)
  2. Increase server's --max-sockets setting
  3. Implement auto-restart (see SOCKET_BEHAVIOR.md)

For details, see SOCKET_BEHAVIOR.md and TESTING_KEEPALIVE.md

Security

Always implement authentication on your local service. LocalTunnel creates a public URL accessible from anywhere!

For security best practices, see SECURITY_ANALYSIS.md

Quickstart

npx localtunnel --port 8000

Installation

Globally

npm install -g localtunnel

As a dependency in your project

yarn add localtunnel

Homebrew

brew install localtunnel

CLI usage

When localtunnel is installed globally, just use the lt command to start the tunnel.

lt --port 8000

Thats it! It will connect to the tunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others for happy fun time!

You can restart your local server all you want, lt is smart enough to detect this and reconnect once it is back.

Arguments

Below are some common arguments. See lt --help for all options.

Basic Options

  • --port or -p (required) - Internal HTTP server port
  • --host or -h - Upstream server providing forwarding (default: https://localtunnel.me)
  • --subdomain or -s - Request a named subdomain on the localtunnel server (default is random)
  • --local-host or -l - Proxy to this hostname instead of localhost
  • --open or -o - Opens the tunnel URL in your browser
  • --print-requests - Print basic request info to console

HTTPS Options

  • --local-https - Tunnel traffic to a local HTTPS server
  • --local-cert - Path to certificate PEM file for local HTTPS server
  • --local-key - Path to certificate key file for local HTTPS server
  • --local-ca - Path to certificate authority file for self-signed certificates
  • --allow-invalid-cert - Disable certificate checks (use only in development!)

⚡ New Options (v2.1.0)

  • --keep-alive - Experimental: Keep tunnel connections alive for reuse

Environment Variables

You may also specify arguments via env variables:

PORT=3000 lt
HOST=https://tunnel.example.com lt

Examples

# Basic usage
lt --port 3000

# Custom subdomain
lt --port 8080 --subdomain my-app

# Custom tunnel server
lt --port 3000 --host https://tunnel.yourdomain.com

# Local HTTPS server
lt --port 443 --local-https --local-cert ./cert.pem --local-key ./key.pem

# With monitoring
lt --port 3000 --print-requests

# Experimental persistent connections
lt --port 3000 --keep-alive

# Open in browser
lt --port 3000 --open

API

The localtunnel client is also usable through an API (for test integration, automation, etc)

localtunnel(port [,options][,callback])

Creates a new localtunnel to the specified local port. Will return a Promise that resolves once you have been assigned a public localtunnel url. options can be used to request a specific subdomain. A callback function can be passed, in which case it won't return a Promise. This exists for backwards compatibility with the old Node-style callback API. You may also pass a single options object with port as a property.

const localtunnel = require("localtunnel");

(async () => {
  const tunnel = await localtunnel({ port: 3000 });

  // the assigned public url for your tunnel
  // i.e. https://abcdefgjhij.localtunnel.me
  tunnel.url;

  tunnel.on("close", () => {
    // tunnels are closed
  });
})();

options

Basic Options
  • port (number) [required] The local port number to expose through localtunnel.
  • subdomain (string) Request a specific subdomain on the proxy server. Note: You may not actually receive this name depending on availability.
  • host (string) URL for the upstream proxy server. Defaults to https://localtunnel.me.
  • local_host (string) Proxy to this hostname instead of localhost. This will also cause the Host header to be re-written to this value in proxied requests.
HTTPS Options
  • local_https (boolean) Enable tunneling to local HTTPS server.
  • local_cert (string) Path to certificate PEM file for local HTTPS server.
  • local_key (string) Path to certificate key file for local HTTPS server.
  • local_ca (string) Path to certificate authority file for self-signed certificates.
  • allow_invalid_cert (boolean) Disable certificate checks for your local HTTPS server (ignore cert/key/ca options).

Refer to tls.createSecureContext for details on the certificate options.

⚡ Advanced Options (v2.1.1)
  • keep_alive (boolean) Keep tunnel connections alive for reuse. Prevents socket exhaustion. Defaults to false.

Example with keep_alive:

const localtunnel = require("localtunnel");

(async () => {
  const tunnel = await localtunnel({ 
    port: 3000,
    keep_alive: true  // Enable persistent connections
  });

  console.log('Tunnel URL:', tunnel.url);
  
  tunnel.on("request", req => {
    console.log('Request:', req.method, req.path);
  });
})();

Tunnel

The tunnel instance returned to your callback emits the following events

| event | args | description | | ------- | ---- | ------------------------------------------------------------------------------------ | | request | info | fires when a request is processed by the tunnel, contains method and path fields | | error | err | fires when an error happens on the tunnel | | close | | fires when the tunnel has closed |

The tunnel instance has the following methods

| method | args | description | | ------ | ---- | ---------------- | | close | | close the tunnel |

other clients

Clients in other languages

go gotunnelme

go go-localtunnel

C#/.NET localtunnel-client

Rust rlt

📚 Documentation

🔧 Troubleshooting

Tunnel Becomes Unavailable After N Requests

Problem: After a certain number of requests, you get "connection refused" errors.

Cause: Socket exhaustion (see SOCKET_BEHAVIOR.md)

Quick Fixes:

# Option 1: Use keep-alive (WORKING in v2.1.1!)
lt --port 3000 --keep-alive

# Option 2: Auto-restart with systemd or supervisor

Test keep-alive: See TESTING_KEEPALIVE.md for complete testing guide.

Connection Refused Errors

Problem: Error: connection refused: IP:PORT

Solutions:

  1. Check your firewall settings
  2. Verify the tunnel server is running
  3. Try a different --host option

HTTPS Certificate Errors

Problem: Certificate validation failures

Solutions:

# Development only - allow self-signed certs
lt --port 3000 --local-https --allow-invalid-cert

# Production - use valid certificates
lt --port 3000 --local-https --local-cert ./cert.pem --local-key ./key.pem

🚀 Production Deployment

For production use:

  1. Use a custom tunnel server (not public localtunnel.me)
  2. Implement authentication on your local service
  3. Enable auto-restart (systemd, PM2, etc.)
  4. Monitor requests with --print-requests
  5. Use HTTPS for sensitive data

Example systemd service:

[Unit]
Description=LocalTunnel Client
After=network.target

[Service]
Type=simple
User=myuser
ExecStart=/usr/bin/lt --port 3000 --host https://tunnel.example.com --keep-alive
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

server

See localtunnel/server for details on the server that powers localtunnel.

For our improved server with persistent connections support, contact the maintainers.

other clients

Clients in other languages

go gotunnelme

go go-localtunnel

C#/.NET localtunnel-client

Rust rlt

🤝 Contributing

Contributions welcome! Please:

  1. Read the documentation
  2. Test your changes
  3. Update docs if needed
  4. Submit a pull request

📄 License

MIT