Deploy a Zero-Code Maintenance Mode for Your Services
Whenever you're making infrastructure changes, a major upgrade to your services during planned downtime, or experiencing an incident, you still want to maintain a public-facing presence on your endpoints to tell customers what's going on.
With ngrok, you can use Traffic Policy and the custom-response
action to immediately deploy a consistent maintenance message without needing to spin up a new backend service or change DNS records to point to a third-party app.
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.
Loading…
2. Reserve a domain
Navigate to the Domains section of the ngrok dashboard and click New + to reserve a free static domain like https://your-service.ngrok.app
or a custom domain you already own.
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. Create a maintenance page on your Cloud Endpoint with Traffic Policy
While still viewing your new cloud endpoint in the dashboard, copy and paste the policy below into the Traffic Policy editor.
Loading…
What's happening here? This policy "interrupts" every request by providing a custom response containing your maintenance message.
When your maintenance window is over and you're ready to route traffic to your upstream service, remove or comment out the custom-response
action.
Loading…
5. Try out your endpoint
Visit the domain you reserved either in the browser or in the terminal using a tool like curl
.
You should see the app or service at the port connected to your internal Agent Endpoint.
What's next?
- Learn more about using Traffic Policy to return custom responses by trying out our examples.
- View your traffic in Traffic Inspector.