This article explains the legacy version of
Setting up a rate limiting policy involves creating one or more rules. Each rule identifies a set of requests and how they will be rate limited. Information on rule configuration is provided below.
Category | Description |
---|---|
A rate limit may be applied:
|
|
Identify the type of requests that are eligible for rate limiting by:
|
|
Define a maximum request rate before a predefined action is triggered. |
|
Identify the type of requests that are eligible for rate limiting by URL path, request headers, IP address, file extension, and/or request method. A request will only count towards the rate limit when it satisfies the rule's scope. Additionally, if one or more condition group(s) have been defined, then the request must also satisfy all of the conditions defined within at least one condition group. |
|
Define the type of action that will be applied to requests that exceed the above rate limit. |
Rate limiting may be applied across all requests or to each unique client. Define this behavior from within the Apply rate limit to option. The available modes are described below.
Mode | Description |
---|---|
Any request |
Indicates that all requests will count towards the rate limit. Once the specified rate limit is exceeded, it will be enforced without taking into consideration which client submitted the request. This mode is not recommended when there are malicious clients that are spoofing legitimate traffic. This type of configuration may potentially lead to a situation where spoofed traffic is honored while legitimate traffic is rate limited. |
IP address |
Indicates that the requests from each unique client, as determined by its IP address, will be tracked. The specified rate limit will only be enforced on the clients that exceed it. |
IP address and user agent |
Indicates that the requests from each unique client, as determined by each unique combination of IP address and user agentRefers to software that acts on behalf of a user. For example, a web browser (e.g., FireFox, Chrome, and Internet Explorer) is a user agent. A web browser will make HTTP/HTTPS requests based on user actions (e.g., requesting a web site or clicking a link). (e.g., web browser), will be tracked. The specified rate limit will only be enforced on the clients that exceed it. All requests from a specific IP address that contain a blank or missing User-Agent header will be treated as a single client. |
Identify the type of requests that are eligible for rate limiting using the criteria described below.
Define a scope to quickly identify the type of requests that are eligible for rate limiting. Use condition groups to further define the type of requests that will be tracked for the purposes of rate limiting.
By default, a scope condition will only be satisfied when an exact match is found. Enable the Negative match option to configure a scope condition to look for requests that do not match the specified value.
Type | Description |
---|---|
Hostname |
Determines whether this rate limit will be applied to all or specific hostnames. For the purpose of defining a rate limiting scope, the hostname associated with a request is determined by the request's Host header. Select one of the following modes:
Additional restrictions by hostname may be defined through condition groups. Those hostname restrictions are applicable regardless of the selected mode. |
URL path |
Determines whether this rate limit will be restricted to requests that match the specified URL path pattern. For the purposes of this option, specify a URL path pattern that starts directly after the hostname. Do not include a protocol or a hostname. Select one of the following modes:
Additional restrictions by URL path may be defined through condition groups. Those URL path restrictions are applicable regardless of the selected mode. |
The maximum rate at which requests will be honored before a predefined action is applied to it is known as the rate limit. A rate limit defines the number of requests over a given time period (e.g., 5 seconds, 10 seconds, or 1 minute). Define the desired rate limit via the Rate limit option.
Key information:
The source that will be rate limited should be taken into account when defining a rate limit.
A rate limit that applies across all requests should be significantly larger than a rate limit that applies to unique clients.
The specified rate limit is enforced on each edge server based on the number of requests that it receives.
Typically, a single edge server will handle all requests directed to a POP for a specific URL.
If the volume of requests to the above edge server exceeds capacity, then requests will be load balanced to an additional edge server.
Example
All requests within the Los Angeles area for the following image will be handled by a single edge server in a Los Angeles POP
If rate limiting is being applied to unique clients, then it is important to note that requests from a single client may be load balanced to different edge servers based on the requested URL.
Example
A request for a web page may result in 50 subsequent requests for its supporting files (e.g., CSS, JS, and images). Although a single client is requesting all 50 of these assets, these requests may be load balanced across anywhere from 1 to 50 different edge servers in a single POP.
Learn more. (How Does It Work?)
A condition group defines one or more prerequisites that must be met before a request will count towards the rate limit.
A request will only count towards the rate limit when it satisfies the rule's scope. Additionally, if one or more condition group(s) have been defined, then the request must also satisfy all of the conditions defined within at least one condition group.
Learn more about scopes.
The types of prerequisites that may be defined are described below.
Type | Description |
---|---|
File extension |
A request will count towards the rate limit when the filename of the requested content contains a file extension that matches a value defined in the Value(s) option. Syntax: .FileExtension
Example: .htm
|
IP address |
A request will count towards the rate limit when its IP address matches a value defined in the Value(s) option. Make sure to use standard IPv4 and CIDR notation. Specify a subnet by appending a slash (/) and the desired bit-length of the prefix (e.g., 11.22.33.0/22). |
A request will count towards the rate limit when the value corresponding the specified request header is an exact case-sensitive match for the one defined in the Value(s) option. This condition supports the following request headers:
HostA request will count towards the rate limit when its Host header matches the specified hostname or IP address. Syntax:
Key information:
User-AgentA request will count towards the rate limit when its User-Agent header matches the specified user agent. The request's user agent must be an exact match to the specified value. User agent strings typically vary by type and version. Match for requests with a blank or missing User-Agent header by specifying a blank value. RefererA request will count towards the rate limit when its Referer header matches the specified referrer. The request's referrer must be an exact match to the specified value. |
|
Request method |
A request will count towards the rate limit when the request's HTTP method matches a value defined in the Value(s) option. Valid values are:
|
Request URL path |
A request will count towards the rate limit when its request URL contains a relative path that matches a value defined in the Value(s) option. For the purposes of this option, specify a URL path pattern that starts directly after the hostname. Do not include a protocol or a hostname. This type of match condition requires a Host condition within the same condition group. Syntax: /path/asset
Example: /marketing/brochures/widget.htm
A partial match does not count towards the rate limit. For example, given the above sample configuration, the following request would not count towards the rate limit: http://cdn.mydomain.com/marketing/brochures/widget.html. |
Key information:
A request will count towards the rate limit when it satisfies either of the following:
Each condition must contain a value through which requests will be identified.
Keep in mind the following limitations when setting up a rate limiting policy:
Type | Limit |
---|---|
Rules |
|
Condition Groups per Rule |
5 |
Conditions per Condition Group |
5 |
IP Address: 200 All Other Conditions: 100 |
Learn how to set up a condition group.
An action defines how rate limiting is enforced upon requests and the duration for which this enforcement will be applied to each client.
Requests that originate from rate limited clients will not count towards the rate limit. Upon the expiration of the time period defined in the Duration option, we will resume counting these requests. If the client exceeds the rate limit again, then this action will be reapplied to it for the duration defined by this option.
A "client" is defined by each rule according to the Apply rate limit to option. For example, configuring that option to "Any request" will apply the selected action to all requests regardless of the number of requests generated by each device. Alternatively, identifying clients by "IP address" will only apply the selected action to requests that originate from each IP address that violates the specified rate limit.
The available types of actions are described below.
Name | Description |
---|---|
Redirect (302 Found) |
Rate limited requests will be redirected to the specified URL. Key information:
|
Custom response |
Rate limited requests will receive the response defined under this option. Configure the following settings:
|
Drop request |
Rate limited requests will be dropped and the client will receive the following response:
The Retry-After response header provides a hint to the client as to when service may resume. |
Alert only |
Rate limited requests will only generate an alert. Use this mode to track rate limited requests through the dashboard without affecting traffic. |