- Host any number of services under a single hostname (for example,
your-company.com) by routing via path, subdomain, headers, or any other Traffic Policy variable. - Apply certain policies like authentication at your gateway, then layer in other policies for specific services.
- Prevent your services or their host systems from being exposed to the public internet.
- Give infrastructure and platform teams control over creating consistent global policy while also allowing developers to manage how traffic reaches their services.
1. Create an endpoint for your service
Start an internal Agent Endpoint, replacing$PORT based on where your service listens.
You can also use one of our SDKs or the Kubernetes Operator.
2. Reserve a domain
Navigate to the Domains section of the ngrok dashboard and click New + to reserve a free static domain like or a custom domain you already own. We’ll refer to this domain as$NGROK_DOMAIN from here on out.
3. Create a Cloud Endpoint
Navigate to the Endpoints section of the ngrok dashboard, then click New + and Cloud Endpoint. In the URL field, enter the domain you just reserved to finish creating your Cloud Endpoint.4. Add routing to your service with Traffic Policy
While viewing your new cloud endpoint in the dashboard, copy the policy below and paste it into the Traffic Policy editor.https://service.internal.
5. Try out your endpoint
Visit the domain you reserved either in the browser or in the terminal using a tool likecurl.
You should see the app or service at the port connected to your internal Agent Endpoint.
Optional: Add a second service and routing
If you have another service to host under the front door pattern, start another agent./one and /two with the paths you’d like to use for routing traffic to each service.
/one path to the internal agent endpoint at https://service.internal and requests to the /two path to https://service-two.internal.
What’s next?
- Traffic Policy enables you to do many more things worth your endpoints.
For example, try adding authentication to your endpoint with the
oauthaction orbasic-authaction. - View your traffic in Traffic Inspector to find potential issues or observe patterns of traffic you may way to block using additional policies on your Cloud Endpoint.