ngrok config check or edit the file in your terminal by running ngrok config edit.
YAML is whitespace-sensitive.
Use spaces only (tabs are not valid in YAML) and keep keys at the same level aligned to the same column.✅ Valid:❌ Invalid—
upstream is indented inconsistently and will fail to parse:Breaking changes
There are important differences between the v3 ngrok Agent Configuration file and v2:- Agent configuration options are no longer top-level.
They’re now nested under the
agentfield. - Endpoints are now configured through the
endpointsfield. - Deprecated the
tunnelsfield in favor ofendpoints. - Changed
server_addragent configuration field toconnect_url. - Changed
root_casagent configuration field toconnect_cas. - Labeled tunnels are no longer supported in v3. Use endpoints instead.
Migrating from v2
Migrating from v2 to v3 requires you to update to the latest agent, nest your agent configuration options under theagent field, change the version field to 3, and modify any agent configuration fields that have changed.
Here’s an example v2 configuration file:
version, introduce the agent field, and convert from tunnels to endpoints:
- Change
root_castoconnect_cas - Change
server_addrtoconnect_url
Supported fields
The ngrok Agent Configuration file supports the following top-level configuration fields:- Configuration File Version Field -
version(required) - Agent Configuration Field -
agent(required) - Endpoint Definitions -
endpoints - Tunnel Definitions -
tunnels(deprecated)
Version
The top-levelversion field is required.
Value must be 3.
Example
Agent configuration
The top-levelagent field is required.
The agent field allows you to modify both general and advanced agent configuration options, everything from your authtoken to whether the agent should check for updates.
Agent configuration options
authtoken
The authentication token used to authenticate this agent when it connects to the ngrok service.
You can obtain your default authtoken through the ngrok dashboard.
Deploying on multiple devices
Your default authtoken works on multiple machines or devices. However, if you want more control and security across many devices, you can generate a unique authtoken for each device in the ngrok dashboard or via thengrok api credentials command.
Example
api_key
This option is only required when you want to make requests using the
ngrok api command and shouldn’t be confused with the authtoken option.ngrok api command.
You can obtain and manage your API keys through the ngrok dashboard.
Example
connect_cas
These are the root certificate authorities used to validate the TLS connection to the ngrok server.
connect_interface
Sets the specific network interface that the ngrok agent should use.
This is only supported on Linux platforms.
connect_timeout
How long to wait when establishing an agent session connection to the ngrok service.
This is specified as a duration, with the default being 10s.
connect_url
This is the URL of the ngrok server to connect to.
You should set this if you’re using a custom Connect URL.
See the Connect URL docs for more information.
console_ui
This option allows you to enable or disable the console UI that appears in your terminal window after you start ngrok.
console_ui_color
The command sets the background color when displaying the console UI in the terminal.
To choose a color other than black, set the value to transparent and change the background of your terminal window.
crl_noverify
This option skips verifying with the Certificate Revocation List if set to true.
This defaults to false.
crl_url
The URL the ngrok agent fetches the Certificate Revocation List (CRL) from.
The default is http://crl.ngrok-agent.com/ngrok.crl.
The URL must use the http or https scheme.
Set this option if your network blocks outbound connections on port 80.
For example, https://crl.ngrok-agent.com/ngrok.crl fetches the same CRL over HTTPS on port 443.
The agent verifies the CRL’s signature, so you can also serve a mirrored copy from your own host.
This option has no effect when crl_noverify is true.
Available in ngrok agent version 3.39.7 and later.
dns_resolver_ips
Consult these DNS servers for tunnel session DNS resolution.
By default, the ngrok agent uses the local system DNS servers to resolve.
heartbeat_interval
How often the ngrok agent should heartbeat to the ngrok servers defined as a duration.
The default is 10s.
heartbeat_tolerance
Reconnect the agent tunnel session if the server doesn’t respond to a heartbeat within this tolerance defined as a duration.
The default is 15s.
inspect_db_size
This is the upper limit in bytes on memory to allocate when saving requests over HTTP endpoints for inspection and replay.
The default is 0, which means 50MB.
log_level
This is the logging level of detail.
In increasing order of verbosity, possible values are: crit, warn, error, info, and debug.
log_format
This is the format of written log records.
log
This is the destination where ngrok should write the logs.
metadata
This is a user-supplied custom string that’s returned as part of the ngrok API response to the list online sessions resource for all endpoints started by this agent.
This is a useful mechanism to identify endpoints by your own device or customer identifier.
Maximum 4096 characters.
proxy_url
This is the URL of an HTTP or SOCKS5 proxy to use for establishing the tunnel connection.
Many HTTP proxies have connection size and duration limits that cause ngrok to fail.
Like many other networking tools, ngrok also respects the environment variable http_proxy and http_proxy_env if it’s set.
remote_management
Set this to true to allow the ngrok agent to be remotely managed (stop, restart, update) via the ngrok API or the ngrok dashboard.
Defaults to true.
update_channel
The update channel determines the stability of released builds to update to.
Use ‘stable’ for all production deployments.
update_check
This tells the ngrok agent if it should check for updates.
Defaults to true.
web_addr
This is the network address to bind on for serving the local agent web interface and API.
web_allow_hosts
This is a list of specifiers for which Host headers can make requests against the local agent web interface and API.
The agent strips any port off the Host header before matching.
Example
Allow an IP address and a domain asHost headers:
Working with machine-in-the-middle (MITM) proxies
If you’re working with machine-in-the-middle (MITM) proxies, you may need to specify a custom CA certificate to trust the ngrok server. This may require you to use the ngrok root CA certificate that the agent uses to connect to the ngrok edge. Use the following command to extract the ngrok agent self-signed root CA certificate:strings `which ngrok` | grep 'BEGIN CERTIFICATE' -A 22
This outputs the root CA certificate in PEM format.
Endpoint definitions
Theendpoints field enables you to define and configure multiple endpoints.
Defining multiple endpoints this way enables you to start pre-configured endpoints by name without having to memorize the right arguments every time through the ngrok start command.
You can also use this field to start multiple endpoints at the same time from a single agent using the ngrok start --all flag.
The endpoints field accepts a list of endpoint configurations.
You can find the list of available endpoint configuration options here.
Example
The snippet below defines two HTTPS endpoints, one TCP endpoint, and one TLS endpoint, named ‘httpbin’, ‘demo’, ‘ssh’, and ‘demo-2’, respectively:Start the endpoint named ‘httpbin’
Start all endpoints
Endpoint configuration options
agent_tls_termination
Object.
Configuration for TLS termination at the ngrok agent.
This is applicable only when the endpoint URL scheme is tls://.
agent_tls_termination.mutual_tls_certificate_authorities
String[].
Specifies one or more Root CA certificates (as paths or raw PEM data) to validate client certificates for mutual TLS authentication.
Available only for tls:// URLs.
agent_tls_termination.server_certificate
String.
The server certificate (provided as a file path or raw PEM data) used by the ngrok agent for TLS termination.
Available only for tls:// URLs.
agent_tls_termination.server_private_key
String.
The private key (provided as a file path or raw PEM data) corresponding to the server certificate, used for TLS termination by the ngrok agent.
Available only for tls:// URLs.
name
Required.
String.
A unique name for this endpoint’s configuration.
This is the value you use when running the ngrok start <name> command.
Example
url
String[].
The address you would like to use to forward traffic to your upstream service.
Accepted formats
- Domain -
example.org- When using the domain format, you’re only defining the domain. The scheme and port are inferred.
- Origin -
https://example.ngrok.apporhttps://example.ngrok.app:443ortcp://1.tcp.ngrok.io:12345ortls://example.ngrok.app- When using the origin format, you’re defining the protocol, domain, and port.
HTTP endpoints accept ports
80or443with respective protocol.
- When using the origin format, you’re defining the protocol, domain, and port.
HTTP endpoints accept ports
- Scheme (shorthand) -
https://ortcp://ortls://orhttp://- When using scheme, you’re defining the protocol. HTTP and HTTPS endpoints use your account’s dev domain, and TCP and TLS endpoints receive an ngrok-assigned address.
- Empty - “
- When empty, your endpoint defaults to
httpsand uses your account’s dev domain.
- When empty, your endpoint defaults to
Example
bindings
String[].
Allows you to configure the bindings for this endpoint.
Currently, you can provide only one binding.
The allowed values are internal, public, and kubernetes, which allow you to create public, internal, and Kubernetes endpoints.
This field is only necessary for creating Kubernetes endpoints, because the default for all endpoints is to have a public binding, and ngrok automatically infers an internal binding when the endpoint URL ends in .internal.
To create a Kubernetes endpoint (which projects the endpoint into one or more Kubernetes clusters running the ngrok Operator as a Service resource), set the bindings field to ["kubernetes"].
Example
metadata
String.
An arbitrary string of user-defined metadata for this endpoint.
This value appears on the endpoint object in the ngrok API.
Example
description
String.
An arbitrary user-defined description about this endpoint.
This value appears on the endpoint object in the ngrok API.
Example
traffic_policy
Object.
Accepts a Traffic Policy configuration in YAML format.
Traffic Policy enables you to manage, route, and secure traffic through configuration.
You can learn more about the individual parts of the Traffic Policy and the available actions here:
Example
upstream
Object.
Upstream service configuration options.
upstream.url
String.
The local or remote address you’d like incoming traffic to be forwarded to.
Accepted formats
- Origin -
https://example.orgorhttp://example.org:80ortcp://127.0.0.1:80- When using the origin format, you’re defining the protocol, domain, and port.
- When no port is present and scheme is
httpsorhttp, the port is inferred.- For
https, the port is443. - For
http, the port is80.
- For
- When no port is present and scheme is
- When using the origin format, you’re defining the protocol, domain, and port.
- Domain -
example.org- This is only allowed for
httpsandhttpendpoints.- For
tcpandtlsendpoints, host and port are required.
- For
- When using the domain format, you’re only defining the host.
- Scheme defaults to
http. - Port defaults to
80.
- Scheme defaults to
- This is only allowed for
- Scheme (shorthand) -
https://- This only works for
httpsandhttp.- For
tcpandtls, host and port are required.
- For
- When using scheme, you’re defining the protocol, and the port is inferred on the local host.
- For
https, the port is443. - For
http, the port is80. - Host is
localhost.
- For
- This only works for
- Port (shorthand) -
8080- When using port, you’re defining the port on the local host that receives traffic.
- Scheme defaults to
http. - Host defaults to
localhost.
- Scheme defaults to
- When using port, you’re defining the port on the local host that receives traffic.
Example
upstream.protocol
String.
The application layer protocol the agent should use when talking to your upstream application for HTTP endpoints.
Accepted values
http1(default)http2
Example
upstream.proxy_protocol
String.
The version of PROXY protocol to use with this endpoint, empty if not using.
Possible values are 1 or 2.
Example
Tunnels (deprecated)
v3 still supports thetunnels configuration field.
This is a key-value list of tunnel name to configurations.
Here’s an example:
Tunnel configuration options
You can find the configuration options fortunnels under the Agent Configuration v2 docs.
Example configuration files
The following agent configurations serve as examples for yourngrok.yml file.
Basic
Here’s a basic example configuration file. In this example, the agent authenticates using an authtoken, and the file defines a single HTTPS endpoint namedbasic with an endpoint URL basic.ngrok.app and an upstream URL of localhost:8080.