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 3000

Creates a tunnel to localhost:3000 and provides a public HTTPS URL

Command Flags

FlagDescriptionExample
--domain, -dUse a custom domain-d myapp
--policy, -pApply security policy (can use multiple)-p ngsrv_ips_ABC
--config, -cPath to config file-c ./ngsrv.yml
--force, -fForce create (terminate existing tunnel)-f
--list, -lList active tunnels-l
--no-tuiDisable interactive UI (use simple console output)--no-tui
--traceEnable verbose debug logging--trace

Common Examples

Basic tunnel

ngsrv http 3000

Creates a tunnel with a random subdomain

With custom domain

ngsrv http 3000 --domain myapp

Uses myapp.tnl.ngsrv.com as the public URL

With security policies

ngsrv http 3000 --policy ngsrv_ips_ABC123 --policy ngsrv_time_DEF456

Applies IP security and time-based access policies

Force replace existing tunnel

ngsrv http 3000 --domain myapp --force

Terminates existing tunnel on 'myapp' domain and creates a new one

Using config file

ngsrv http --config ./ngsrv.yml

Reads port, domain, and policies from configuration file

How It Works

When you create an HTTP tunnel, NGSRV:

  1. Establishes a secure, persistent connection to the ngsrv edge
  2. Assigns a public HTTPS URL (random or custom domain)
  3. Forwards all incoming HTTP/HTTPS requests to your local port
  4. Returns responses back to the original client
  5. 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.