Getting Started with Agent Endpoints and Traffic Policy via CLI Flags
What you'll need
- An ngrok account.
- The ngrok Agent CLI installed.
1. Create a Traffic Policy
Create a custom file with the following contents:
Loading…
This policy will respond to each HTTP request with a simple “Hello, World!” message.
2. Apply your Traffic Policy
Run the agent, applying the traffic policy you saved in the previous step with the --traffic-policy-file
flag:
Loading…
This command starts an HTTP tunnel for port 80
, using the specified policy.yml
traffic policy to manage traffic.
3. Test it out
After running the ngrok command in the previous step you should now see a URL in the forwarding section. Open the URL in your web browser. You should see the "Hello, World!" message displayed in your browser.
What's next?
You've now successfully set up your first Agent Endpoint with a custom Traffic Policy using the ngrok agent.
To learn more about ngrok's Traffic Policy and its capabilities, check out the following resources:
- Learn about the core concepts like phases and rules.
- Check out the examples, use-cases and guides.
- The list of available actions, macros and variables you can use.