Skip to content

ngrok

ngrok is a temporary server solution that enables secure tunnels to localhost, primarily used to expose local development environments to the public internet.^[400-devops-02-os-and-linux-basics-network-ngrok.md]

Key Features

One of the primary appeals of ngrok is its accessibility; it is emphasized as being available for free.^[400-devops-02-os-and-linux-basics-network-ngrok.md] The software provides a public domain name that forwards traffic to a specified local port, such as https://1bee-210-66-180-104.jp.ngrok.io forwarding to port 8080.^[400-devops-02-os-and-linux-basics-network-ngrok.md]

Use Cases

ngrok is frequently utilized in scenarios requiring public access to a local machine for testing and integration:

  • Chatbot Development: Used in developing bots for platforms like LINE and Telegram^[400-devops-02-os-and-linux-basics-network-ngrok.md].
  • Webhooks: Essential for testing GitHub webhooks and Slack integrations by allowing external services to reach a local callback URL^[400-devops-02-os-and-linux-basics-network-ngrok.md].

Installation

The software can be downloaded directly from the official website^[400-devops-02-os-and-linux-basics-network-ngrok.md]. For Windows users, it is also available via the Chocolatey package manager using the command choco install ngrok^[400-devops-02-os-and-linux-basics-network-ngrok.md].

Usage Workflow

  1. Registration: Users sign up for an account, commonly using a Google account^[400-devops-02-os-and-linux-basics-network-ngrok.md].
  2. Authentication: The Connect your account step provides an authtoken (referred to as a password in the source) to authorize the installation^[400-devops-02-os-and-linux-basics-network-ngrok.md].
  3. Execution: The tool is started from the command line^[400-devops-02-os-and-linux-basics-network-ngrok.md].

To initiate a tunnel, the basic command syntax is ngrok http <port>, for example:

ngrok http 8080
^[400-devops-02-os-and-linux-basics-network-ngrok.md]

Interface and Inspection

When active, ngrok runs a web interface (defaulting to http://localhost:4040) where users can inspect, replay, and modify incoming requests^[400-devops-02-os-and-linux-basics-network-ngrok.md]. The command line interface displays real-time status, including connection details, latency, and HTTP request logs^[400-devops-02-os-and-linux-basics-network-ngrok.md].

Sources

  • 400-devops-02-os-and-linux-basics-network-ngrok.md