Advanced LocalTunnel Features
While LocalTunnel is simple to get started with, it offers many advanced features that can enhance your development workflow.
1. Custom Subdomains
Request a specific subdomain for your tunnel:
lt --port 8000 --subdomain myproject
2. Local HTTPS Support
Tunnel to local HTTPS servers:
lt --port 8443 --local-https
3. Custom Local Host
Proxy to a different hostname:
lt --port 8000 --local-host myapp.local
4. Certificate Options
For local HTTPS with custom certificates:
lt --port 8443 --local-cert /path/to/cert.pem --local-key /path/to/key.pem
5. Environment Variables
Set options via environment variables:
PORT=3000 SUBDOMAIN=myapp lt
6. API Usage
Use LocalTunnel programmatically:
const localtunnel = require('localtunnel');
(async () => {
const tunnel = await localtunnel({ port: 3000 });
console.log(tunnel.url);
})();
7. Multiple Tunnels
Run multiple tunnels simultaneously for different services.
8. Custom Hosts
Connect to different LocalTunnel servers for enterprise use.
9. Request Monitoring
Monitor all requests passing through your tunnel in real-time.
10. Tunnel Events
Listen for tunnel events like open, close, and error.
These advanced features make LocalTunnel incredibly versatile for complex development scenarios.