Skip to main content

Getting Started with Agent Endpoints and Traffic Policy via Configuration File

The following getting started guide will take you through starting an Agent Endpoint with a Traffic Policy applied via the Agent Configuration File. Note, this guide requires that your agent configuration file is set to v3.

Prerequisites

  1. ngrok Account - Ensure you have an active ngrok account.
  2. ngrok Agent - Download and install the ngrok agent for your operating system.

Step 1: Edit your ngrok Configuration File

Enter the following command into your terminal:

Loading…

You should now be editing your configuration file, append the following content to your config file at the bottom and save the file:

Loading…

This policy will respond to each HTTP request with a simple “Hello, World!” message.

note

Your configuration file version must be set to 3.

Step 2: Start your Agent Endpoint

Start your Agent Endpoint by running the following command:

Loading…

This command will start an HTTP tunnel for port 80, using the specified traffic policy in the config file to manage traffic.

Step 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.

Next Steps

🎉 Congratulations!

You've successfully set up your first Agent Endpoint with a custom Traffic Policy using the ngrok agent configuration file.

To learn more about ngrok's Traffic Policy and it's capabilities, check out the following resources: