TLS Certificates
ngrok automatically handles TLS (SSL) certificate management and termination for you. There is typically nothing to setup, configure or manage.
You can manage TLS certificates on your ngrok dashboard or via the ngrok API.
Overview
TLS certificates are a tuple of a private key and certificate that are presented by the ngrok cloud service during a TLS handshakes to terminate TLS connections to HTTPS endpoints and TLS endpoints. TLS certificates are attached to domains for termination of TLS connections to endpoints whose URLs match that domain. ngrok can automatically provision certificates for you or you can upload your own.
See the TLS Termination documentation for details on how and when ngrok terminates TLS connections.
Certificate Selection
When TLS connections to an endpoint are terminated, ngrok uses the TLS Certificate attached to the domain matching the endpoint's URL for termination.
Each domain has an attached TLS certificate that
is referenced by its certificate_id
field.
If the domain object does reference any certificate, or if there is no matching
domain object for an endpoint's URL, ngrok selects its own TLS certificate for
termination.
You may override the certificate used for by explicitly
terminating TLS yourself with the terminate-tls
traffic policy
action.
Certificate Provisioning
Whenever you create a domain you choose how a TLS certificate will be provisioned. Either:
- Automatic TLS certificates (default) - ngrok automatically provisions a TLS certificate from an ACME provider like Let's Encrypt.
- Bring your own TLS certificates - Upload your own TLS certificate
It is recommended that you choose automatic TLS certificates unless you have special requirements.
Automatic Provisioning
When you choose automatic TLS certificate management for a domain (this is the default), ngrok automatically provisions and renews TLS certificates from an ACME-compliant certificate authority like Let's Encrypt.
ngrok uses an HTTP01 challenge for TLS certificate provisioning of most domains. When you create a wildcard domain ngrok uses a DNS01 challenge instead.
ngrok is a Let's Encrypt sponsor.
Status
TLS certificates are provisioned asynchronously. Depending on the speed of the
ACME certificate authority, it can take anywhere between a few seconds to 10
minutes for your certificate to be provisioned. The domain's
certificate_management_status
field on the TLS Certificate API
Resource contains the status of the
provisioning job.
Bring your own domain
When you bring your own domain
(e.g. api.your-domain.com
) you must create a CNAME DNS record in your DNS
provider. Certificate provisioning will not begin until your create this CNAME
DNS record.