HTTP Tunnels
Expose your local HTTP server to the internet with a public HTTPS URL
Basic Usage
The ngsrv http command creates a secure tunnel to your local HTTP server.
ngsrv http <port>Example:
ngsrv http 3000Creates a tunnel to localhost:3000 and provides a public HTTPS URL
Command Flags
| Flag | Description | Example |
|---|---|---|
| --domain, -d | Use a custom domain | -d myapp |
| --policy, -p | Apply security policy (can use multiple) | -p ngsrv_ips_ABC |
| --config, -c | Path to config file | -c ./ngsrv.yml |
| --force, -f | Force create (terminate existing tunnel) | -f |
| --list, -l | List active tunnels | -l |
| --no-tui | Disable interactive UI (use simple console output) | --no-tui |
| --trace | Enable verbose debug logging | --trace |
Common Examples
Basic tunnel
ngsrv http 3000Creates a tunnel with a random subdomain
With custom domain
ngsrv http 3000 --domain myappUses myapp.tnl.ngsrv.com as the public URL
With security policies
ngsrv http 3000 --policy ngsrv_ips_ABC123 --policy ngsrv_time_DEF456Applies IP security and time-based access policies
Force replace existing tunnel
ngsrv http 3000 --domain myapp --forceTerminates existing tunnel on 'myapp' domain and creates a new one
Using config file
ngsrv http --config ./ngsrv.ymlReads port, domain, and policies from configuration file
How It Works
When you create an HTTP tunnel, NGSRV:
- Establishes a secure, persistent connection to the ngsrv edge
- Assigns a public HTTPS URL (random or custom domain)
- Forwards all incoming HTTP/HTTPS requests to your local port
- Returns responses back to the original client
- Logs all requests for monitoring and debugging
Local Dashboard
While your tunnel is running, visit http://localhost:4040 to see real-time request logs and analytics.
Common Use Cases
Webhook Testing
Test webhooks from services like Stripe, GitHub, or Twilio by providing your tunnel URL as the webhook endpoint.
OAuth Development
Develop OAuth integrations with consistent callback URLs using custom domains.
Mobile Testing
Test your local web app on real mobile devices over HTTPS.
Client Demos
Share work-in-progress with clients without deploying to staging.
Troubleshooting
502 Bad Gateway
Your local server isn't running or isn't listening on the specified port. Start your application first, then create the tunnel.
Connection Refused
Check if your firewall is blocking connections or if your local server only binds to 127.0.0.1 instead of 0.0.0.0.
Tunnel Already Exists
Use --force flag to terminate the existing tunnel and create a new one, or choose a different domain.