Skip to main content

Static dev domains for all ngrok users

772 words

Topics:

One of the major complaints users have with ngrok is that the URL changes every time the agent restarts. Every ngrok account now comes with a free dev domain to alleviate this issue.

Dev domains are automatically assigned to your account and remain yours as long as you have an ngrok account. Your dev domain uses the ngrok-free.dev base domains—for example, abc123xyz.ngrok-free.dev.

With your free dev domain, you can focus on developing your application or configuring ngrok as a gateway to your production services without needing to worry about the default behavior of the ngrok agent, which generates a random URL like https://9490551445c1.ngrok.app. That makes the development and testing lifecycle even easier, especially for pre-release versions or internal apps.

Dev domains aren’t billed for endpoint hours and don’t count toward the domain limits of paid plans. If you need a custom or branded domain, you can upgrade to a paid plan—our Hobbyist plan lets you choose custom ngrok domains like your-company.ngrok.app, while our pay-as-you-go plan lets you bring your own domain to create endpoints like api.your-company.com and app.your-company.com.

Our mission is to equip developers with composable infrastructure that makes putting APIs and apps online as simple as ngrok http .... Free dev domains get all of us one crucial step closer to that vision.

Find your dev domain

Your dev domain is automatically assigned when you create your ngrok account. To find it:

  1. Log in to your ngrok account.
  2. Navigate to Gateway > Domains.
  3. Look for your dev domain (it will be on an ngrok-free.dev base domain).

Put your dev domain to use

You can use ngrok and your dev domain to front your apps and APIs no matter where you run them or how they’re packaged.

With the ngrok CLI

The fastest way to get started with your dev domain is to create an agent endpoint. In this case, your dev domain routes traffic directly to the API or app service running on port 8000.

ngrok http 8000 --url https://<YOUR_DEV_DOMAIN>

With a cloud endpoint

Cloud endpoints are always online and not tied to the lifecycle of an ngrok agent—you can think of them like serverless functions for handling traffic.

In the ngrok dashboard, head to Endpoints > + New and type in your dev domain.

Cloud endpoints are perfect for creating a single point of ingress for your root domain at your-company.com—that’s exactly what we do for ngrok.com. When combined with internal endpoints, you can route traffic to any number of upstream services and control the configuration from one place.

With an ngrok agent SDK

Another way to use ngrok and your dev domain is via the ngrok agent SDKs, which allow you to embed ngrok’s functions directly into your APIs or apps.

For example, using the ngrok-go SDK:

1package main2 3import (4	"context"5	"fmt"6	"log"7	"net/http"8 9	"golang.ngrok.com/ngrok/v2"10)11 12func main() {13	// ngrok.Listen reads NGROK_AUTHTOKEN from the environment automatically.14	ln, err := ngrok.Listen(context.Background(), ngrok.WithURL("https://<YOUR_DEV_DOMAIN>"))15	if err != nil {16		log.Fatal(err)17	}18	log.Println("Application available at:", ln.URL())19	err = http.Serve(ln, http.HandlerFunc(handler))20	if err != nil {21		log.Fatal(err)22	}23}24 25func handler(w http.ResponseWriter, r *http.Request) {26	fmt.Fprintln(w, "Hello from ngrok-go!")27}

Once you run go run main.go, ngrok creates an agent endpoint on your dev domain and makes this application accessible from anywhere in the world.

With a Kubernetes cluster

If you’re using Kubernetes to make your APIs or apps available to the public, you can leverage our Kubernetes Operator to handle ingress and load balancing without dealing deeply with Ingress or Gateway API resources.

1apiVersion: networking.k8s.io/v12kind: Ingress3metadata:4  name: example-ingress5spec:6  ingressClassName: ngrok7  rules:8    - host: <YOUR_DEV_DOMAIN>9      http:10        paths:11          - path: /12            backend:13              serviceName: example-service14              servicePort: 80

The Kubernetes Operator then creates pods and services to route all traffic on https://<YOUR_DEV_DOMAIN> to the example-service pod.

Sign up and get started today

If you don’t yet have an ngrok account, you can sign up for free—your dev domain is automatically assigned when you create your account. Check out our pricing page to compare plans.

For smaller projects, the hobbyist plan lets you use custom ngrok-branded subdomains, like example.ngrok.app.

When you’re ready to start using ngrok for production, check out our pay-as-you-go plan, which lets you add your custom branded domain. Then update your DNS records to point to ngrok to create as many subdomains as you need and handle ingress to all your services from one place.

Let us know if you run into any problems or have any questions either by emailing our customer success team or by dropping an issue in our community repo.

Frequently asked questions

Avatar for Nijiko Yonskai

Nijiko Yonskai

Niji is a Principal Product Manager who helps shape ngrok user experience. Previously product at Kong and Postman.

Share this post

  • New ngrok domains now available

    Announcing new ngrok domains for free and paid users. Automatically route traffic to the nearest region, providing visitors with a faster experience.

  • Introducing Cloud Endpoints

    Have you ever wanted an ngrok endpoint that doesn’t go offline when you get disconnected from the internet? Now possible with always-on cloud endpoints.