ngrok
Expose local server to public internet
TLDR
Expose a local HTTP service on a given port
Expose a local HTTP service on a specific host
Expose a local HTTPS server
Expose TCP traffic on a given port
Expose TLS traffic for a specific host and port
SYNOPSIS
ngrok command [ arguments ]
PARAMETERS
http port
Exposes a local HTTP server running on the specified port to the internet.
tcp port
Exposes a local TCP server running on the specified port to the internet.
tls port
Exposes a local TLS server running on the specified port to the internet.
start tunnel_name
Starts a specific tunnel defined in the ngrok configuration file.
start-all
Starts all tunnels defined in the ngrok configuration file.
config path
Specifies the path to the ngrok configuration file.
authtoken token
Sets the ngrok authtoken for authentication (usually found on the ngrok dashboard).
region region
Specifies the region where the ngrok server will be located (e.g., us, eu, ap).
version
Displays the ngrok version information.
help
Displays help information about ngrok commands.
DESCRIPTION
ngrok is a cross-platform application that creates secure tunnels from a local machine to ngrok's servers.
This allows you to expose local web servers, development environments, and other services running on your machine to the public internet without needing to configure port forwarding, DNS records, or deploy to a remote server.
ngrok is commonly used for:
* Testing webhooks and integrations.
* Sharing local websites for demos or collaboration.
* Remotely accessing IoT devices or APIs.
* Debugging applications running in development environments.
The core function is to establish a secure connection and provide a public URL that forwards traffic to a specified port on your local machine. ngrok is very popular due to its ease of use and support for various protocols like HTTP, HTTPS, TCP, and TLS. The free tier has limitations, but paid plans offer more features and stability.
CAVEATS
The free version of ngrok has limitations on connection time, number of tunnels, and bandwidth. Connection stability and consistent URLs are typically available with paid plans. The service requires an internet connection to work.
CONFIGURATION FILE
ngrok can be configured using a YAML configuration file. This allows you to define multiple tunnels with specific settings, such as the protocol, local port, and subdomain. The configuration file is typically located in the user's home directory under `.ngrok2/ngrok.yml`.
WEB INTERFACE
When running ngrok, a web interface is available (typically at http://127.0.0.1:4040) that provides information about active tunnels, request logs, and other debugging tools.
HISTORY
ngrok was created to address the problem of exposing local development servers for testing webhooks and integrations. It has become a popular tool for developers and testers to easily share and access local applications without complex networking configuration.