Skip to main content
ngrok’s Traffic Policy is a configuration language that offers you the flexibility to filter, match, manage, and orchestrate traffic to your endpoints.
  • Validate incoming traffic, block malicious traffic, rewrite URLs, and respond with custom content.
  • Forward traffic to your agents running across the globe and orchestrate traffic across your infrastructure.
  • Add Traffic Policies to any type of ngrok endpoint to scope traffic management for each of your endpoints.

How It Works

Learn how Traffic Policy works under the hood.

Get Started

Create your first Traffic Policy and start an endpoint to see it in action.

Actions

Actions are how you manage traffic in your Traffic Policies. They allow you to modify request headers, transform response bodies, and more.

Examples

Explore a gallery of real-world examples to see how you can incorporate Traffic Policy into your setup.

Features

  • Actions - Transform, redirect, and manage traffic flow with actions like add-headers, rate-limit, and jwt-validation.
  • Variables - Predefined values representing things like the IP address associated with a request, the URL of the endpoint accepting the traffic, and more, which can be used to dynamically manage traffic.
  • Macros - Apply macros in rule conditions to refine traffic segmentation and configure actions with dynamic precision.

Use cases

Block unwanted requests

Block malicious traffic, Tor exit nodes, bots, and specific IP addresses from accessing your endpoints.

Add authentication

Add JWT validation, OAuth, OIDC, and basic authentication to secure your endpoints.

Rate limit requests

Rate limit requests based on endpoint, IP address, or API key to protect your services.

Rewrite URLs

Rewrite URLs and paths to route traffic to different backend services or endpoints.

What’s next?

  • Get started by applying a Traffic Policy to your app with the ngrok agent.
  • Learn the key concepts that make up a Traffic Policy and how it works.
  • Explore practical examples to see Traffic Policies in action.