Protecting Services with Rate Limiting
Rate limiting is a critical feature that prevents your services from being overwhelmed by excessive network traffic. By enforcing rate limits, you can control how many requests are allowed over a given period, helping to:
⚡ Maintain API performance by preventing excessive load.
🔐 Protect against abuse and malicious traffic.
🌍 Ensure fair usage across clients and users.
🔍 What are the Benefits of Rate Limiting?
Without rate limiting, a single misconfigured client or a spike in traffic could easily overload your backend. Implementing rate limiting at the network edge helps prevent:
- API overuse and abuse (e.g., DDoS attacks, aggressive polling).
- Performance degradation for other users.
- Unexpected infrastructure costs due to excessive traffic.
Key Benefits:
- Prevents Service Overload: Ensures API stability even under high traffic.
- Protects Against Automated Abuse: Stops bots and scrapers from overwhelming services.
- Ensures Fair Usage: Distributes API resources evenly among users.
- Reduces Infrastructure Costs: Avoids unnecessary scaling due to excessive requests.
- Improves Security & Compliance: Helps meet API quotas and prevent brute-force attacks.
Rate Limiting Examples
The following examples demonstrate how to rate limit all incoming requests by the Host
header.
Check out the rate limit traffic policy action page for more details about how it functions and the parameters it accepts.
- AgentEndpoint
- CloudEndpoint
- Ingress
- Gateway API
Loading…
Loading…
💡 Ingress
resources do not natively support rate limiting, but they can be extended using a traffic policy.
1. Create an NgrokTrafficPolicy
Loading…
2. Use the NgrokTrafficPolicy
on an Ingress
Loading…
💡 Gateway API resources do not natively support rate limiting, but they can be extended using a traffic policy.
1. Create an NgrokTrafficPolicy
Loading…
2. Use the NgrokTrafficPolicy
on a Gateway
The following example showcases supplying the NgrokTrafficPolicy
on a Gateway
resource. All requests to the Gateway
will run the traffic policy.
If you prefer, NgrokTrafficPolicy
can also be used on the route level by using an externalRef
filter on an HTTPRoute
. See the using Gateway API guide for examples.
Loading…