cloudflare.RateLimit
Explore with Pulumi AI
cloudflare.RateLimit
is in a deprecation phase until June 15th, 2025. During this time period, this resource is still fully supported but you are strongly advised to move to thecloudflare.Ruleset
resource. Full details can be found in the developer documentation.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleRateLimit = new cloudflare.RateLimit("example_rate_limit", {
zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
action: {
mode: "challenge",
response: {
body: "<error>This request has been rate-limited.</error>",
contentType: "text/xml",
},
timeout: 86400,
},
match: {
headers: [{
name: "Cf-Cache-Status",
op: "ne",
value: "HIT",
}],
request: {
methods: [
"GET",
"POST",
],
schemes: [
"HTTP",
"HTTPS",
],
url: "*.example.org/path*",
},
response: {
originTraffic: true,
},
},
period: 900,
threshold: 60,
});
import pulumi
import pulumi_cloudflare as cloudflare
example_rate_limit = cloudflare.RateLimit("example_rate_limit",
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
action={
"mode": "challenge",
"response": {
"body": "<error>This request has been rate-limited.</error>",
"content_type": "text/xml",
},
"timeout": 86400,
},
match={
"headers": [{
"name": "Cf-Cache-Status",
"op": "ne",
"value": "HIT",
}],
"request": {
"methods": [
"GET",
"POST",
],
"schemes": [
"HTTP",
"HTTPS",
],
"url": "*.example.org/path*",
},
"response": {
"origin_traffic": True,
},
},
period=900,
threshold=60)
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.NewRateLimit(ctx, "example_rate_limit", &cloudflare.RateLimitArgs{
ZoneId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
Action: &cloudflare.RateLimitActionArgs{
Mode: pulumi.String("challenge"),
Response: &cloudflare.RateLimitActionResponseArgs{
Body: pulumi.String("<error>This request has been rate-limited.</error>"),
ContentType: pulumi.String("text/xml"),
},
Timeout: pulumi.Float64(86400),
},
Match: &cloudflare.RateLimitMatchArgs{
Headers: cloudflare.RateLimitMatchHeaderArray{
&cloudflare.RateLimitMatchHeaderArgs{
Name: pulumi.String("Cf-Cache-Status"),
Op: pulumi.String("ne"),
Value: pulumi.String("HIT"),
},
},
Request: &cloudflare.RateLimitMatchRequestArgs{
Methods: pulumi.StringArray{
pulumi.String("GET"),
pulumi.String("POST"),
},
Schemes: pulumi.StringArray{
pulumi.String("HTTP"),
pulumi.String("HTTPS"),
},
Url: pulumi.String("*.example.org/path*"),
},
Response: &cloudflare.RateLimitMatchResponseArgs{
OriginTraffic: pulumi.Bool(true),
},
},
Period: pulumi.Float64(900),
Threshold: pulumi.Float64(60),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var exampleRateLimit = new Cloudflare.RateLimit("example_rate_limit", new()
{
ZoneId = "023e105f4ecef8ad9ca31a8372d0c353",
Action = new Cloudflare.Inputs.RateLimitActionArgs
{
Mode = "challenge",
Response = new Cloudflare.Inputs.RateLimitActionResponseArgs
{
Body = "<error>This request has been rate-limited.</error>",
ContentType = "text/xml",
},
Timeout = 86400,
},
Match = new Cloudflare.Inputs.RateLimitMatchArgs
{
Headers = new[]
{
new Cloudflare.Inputs.RateLimitMatchHeaderArgs
{
Name = "Cf-Cache-Status",
Op = "ne",
Value = "HIT",
},
},
Request = new Cloudflare.Inputs.RateLimitMatchRequestArgs
{
Methods = new[]
{
"GET",
"POST",
},
Schemes = new[]
{
"HTTP",
"HTTPS",
},
Url = "*.example.org/path*",
},
Response = new Cloudflare.Inputs.RateLimitMatchResponseArgs
{
OriginTraffic = true,
},
},
Period = 900,
Threshold = 60,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.RateLimit;
import com.pulumi.cloudflare.RateLimitArgs;
import com.pulumi.cloudflare.inputs.RateLimitActionArgs;
import com.pulumi.cloudflare.inputs.RateLimitActionResponseArgs;
import com.pulumi.cloudflare.inputs.RateLimitMatchArgs;
import com.pulumi.cloudflare.inputs.RateLimitMatchRequestArgs;
import com.pulumi.cloudflare.inputs.RateLimitMatchResponseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleRateLimit = new RateLimit("exampleRateLimit", RateLimitArgs.builder()
.zoneId("023e105f4ecef8ad9ca31a8372d0c353")
.action(RateLimitActionArgs.builder()
.mode("challenge")
.response(RateLimitActionResponseArgs.builder()
.body("<error>This request has been rate-limited.</error>")
.contentType("text/xml")
.build())
.timeout(86400.0)
.build())
.match(RateLimitMatchArgs.builder()
.headers(RateLimitMatchHeaderArgs.builder()
.name("Cf-Cache-Status")
.op("ne")
.value("HIT")
.build())
.request(RateLimitMatchRequestArgs.builder()
.methods(
"GET",
"POST")
.schemes(
"HTTP",
"HTTPS")
.url("*.example.org/path*")
.build())
.response(RateLimitMatchResponseArgs.builder()
.originTraffic(true)
.build())
.build())
.period(900.0)
.threshold(60.0)
.build());
}
}
resources:
exampleRateLimit:
type: cloudflare:RateLimit
name: example_rate_limit
properties:
zoneId: 023e105f4ecef8ad9ca31a8372d0c353
action:
mode: challenge
response:
body: <error>This request has been rate-limited.</error>
contentType: text/xml
timeout: 86400
match:
headers:
- name: Cf-Cache-Status
op: ne
value: HIT
request:
methods:
- GET
- POST
schemes:
- HTTP
- HTTPS
url: '*.example.org/path*'
response:
originTraffic: true
period: 900
threshold: 60
Create RateLimit Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RateLimit(name: string, args: RateLimitArgs, opts?: CustomResourceOptions);
@overload
def RateLimit(resource_name: str,
args: RateLimitArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RateLimit(resource_name: str,
opts: Optional[ResourceOptions] = None,
action: Optional[RateLimitActionArgs] = None,
match: Optional[RateLimitMatchArgs] = None,
period: Optional[float] = None,
threshold: Optional[float] = None,
zone_id: Optional[str] = None)
func NewRateLimit(ctx *Context, name string, args RateLimitArgs, opts ...ResourceOption) (*RateLimit, error)
public RateLimit(string name, RateLimitArgs args, CustomResourceOptions? opts = null)
public RateLimit(String name, RateLimitArgs args)
public RateLimit(String name, RateLimitArgs args, CustomResourceOptions options)
type: cloudflare:RateLimit
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RateLimitArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RateLimitArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RateLimitArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RateLimitArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RateLimitArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var rateLimitResource = new Cloudflare.RateLimit("rateLimitResource", new()
{
Action = new Cloudflare.Inputs.RateLimitActionArgs
{
Mode = "string",
Response = new Cloudflare.Inputs.RateLimitActionResponseArgs
{
Body = "string",
ContentType = "string",
},
Timeout = 0,
},
Match = new Cloudflare.Inputs.RateLimitMatchArgs
{
Headers = new[]
{
new Cloudflare.Inputs.RateLimitMatchHeaderArgs
{
Name = "string",
Op = "string",
Value = "string",
},
},
Request = new Cloudflare.Inputs.RateLimitMatchRequestArgs
{
Methods = new[]
{
"string",
},
Schemes = new[]
{
"string",
},
Url = "string",
},
Response = new Cloudflare.Inputs.RateLimitMatchResponseArgs
{
OriginTraffic = false,
},
},
Period = 0,
Threshold = 0,
ZoneId = "string",
});
example, err := cloudflare.NewRateLimit(ctx, "rateLimitResource", &cloudflare.RateLimitArgs{
Action: &cloudflare.RateLimitActionArgs{
Mode: pulumi.String("string"),
Response: &cloudflare.RateLimitActionResponseArgs{
Body: pulumi.String("string"),
ContentType: pulumi.String("string"),
},
Timeout: pulumi.Float64(0),
},
Match: &cloudflare.RateLimitMatchArgs{
Headers: cloudflare.RateLimitMatchHeaderArray{
&cloudflare.RateLimitMatchHeaderArgs{
Name: pulumi.String("string"),
Op: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
Request: &cloudflare.RateLimitMatchRequestArgs{
Methods: pulumi.StringArray{
pulumi.String("string"),
},
Schemes: pulumi.StringArray{
pulumi.String("string"),
},
Url: pulumi.String("string"),
},
Response: &cloudflare.RateLimitMatchResponseArgs{
OriginTraffic: pulumi.Bool(false),
},
},
Period: pulumi.Float64(0),
Threshold: pulumi.Float64(0),
ZoneId: pulumi.String("string"),
})
var rateLimitResource = new RateLimit("rateLimitResource", RateLimitArgs.builder()
.action(RateLimitActionArgs.builder()
.mode("string")
.response(RateLimitActionResponseArgs.builder()
.body("string")
.contentType("string")
.build())
.timeout(0)
.build())
.match(RateLimitMatchArgs.builder()
.headers(RateLimitMatchHeaderArgs.builder()
.name("string")
.op("string")
.value("string")
.build())
.request(RateLimitMatchRequestArgs.builder()
.methods("string")
.schemes("string")
.url("string")
.build())
.response(RateLimitMatchResponseArgs.builder()
.originTraffic(false)
.build())
.build())
.period(0)
.threshold(0)
.zoneId("string")
.build());
rate_limit_resource = cloudflare.RateLimit("rateLimitResource",
action={
"mode": "string",
"response": {
"body": "string",
"content_type": "string",
},
"timeout": 0,
},
match={
"headers": [{
"name": "string",
"op": "string",
"value": "string",
}],
"request": {
"methods": ["string"],
"schemes": ["string"],
"url": "string",
},
"response": {
"origin_traffic": False,
},
},
period=0,
threshold=0,
zone_id="string")
const rateLimitResource = new cloudflare.RateLimit("rateLimitResource", {
action: {
mode: "string",
response: {
body: "string",
contentType: "string",
},
timeout: 0,
},
match: {
headers: [{
name: "string",
op: "string",
value: "string",
}],
request: {
methods: ["string"],
schemes: ["string"],
url: "string",
},
response: {
originTraffic: false,
},
},
period: 0,
threshold: 0,
zoneId: "string",
});
type: cloudflare:RateLimit
properties:
action:
mode: string
response:
body: string
contentType: string
timeout: 0
match:
headers:
- name: string
op: string
value: string
request:
methods:
- string
schemes:
- string
url: string
response:
originTraffic: false
period: 0
threshold: 0
zoneId: string
RateLimit Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RateLimit resource accepts the following input properties:
- Action
Rate
Limit Action - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- Match
Rate
Limit Match - Determines which traffic the rate limit counts towards the threshold.
- Period double
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- Threshold double
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - Zone
Id string - Identifier
- Action
Rate
Limit Action Args - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- Match
Rate
Limit Match Args - Determines which traffic the rate limit counts towards the threshold.
- Period float64
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- Threshold float64
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - Zone
Id string - Identifier
- action
Rate
Limit Action - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- match
Rate
Limit Match - Determines which traffic the rate limit counts towards the threshold.
- period Double
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold Double
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone
Id String - Identifier
- action
Rate
Limit Action - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- match
Rate
Limit Match - Determines which traffic the rate limit counts towards the threshold.
- period number
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold number
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone
Id string - Identifier
- action
Rate
Limit Action Args - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- match
Rate
Limit Match Args - Determines which traffic the rate limit counts towards the threshold.
- period float
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold float
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone_
id str - Identifier
- action Property Map
- The action to perform when the threshold of matched traffic within the configured period is exceeded.
- match Property Map
- Determines which traffic the rate limit counts towards the threshold.
- period Number
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold Number
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone
Id String - Identifier
Outputs
All input properties are implicitly available as output properties. Additionally, the RateLimit resource produces the following output properties:
- Bypasses
List<Rate
Limit Bypass> - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- Description string
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- Disabled bool
- When true, indicates that the rate limit is currently disabled.
- Id string
- The provider-assigned unique ID for this managed resource.
- Bypasses
[]Rate
Limit Bypass - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- Description string
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- Disabled bool
- When true, indicates that the rate limit is currently disabled.
- Id string
- The provider-assigned unique ID for this managed resource.
- bypasses
List<Rate
Limit Bypass> - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description String
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled Boolean
- When true, indicates that the rate limit is currently disabled.
- id String
- The provider-assigned unique ID for this managed resource.
- bypasses
Rate
Limit Bypass[] - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description string
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled boolean
- When true, indicates that the rate limit is currently disabled.
- id string
- The provider-assigned unique ID for this managed resource.
- bypasses
Sequence[Rate
Limit Bypass] - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description str
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled bool
- When true, indicates that the rate limit is currently disabled.
- id str
- The provider-assigned unique ID for this managed resource.
- bypasses List<Property Map>
- Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description String
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled Boolean
- When true, indicates that the rate limit is currently disabled.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing RateLimit Resource
Get an existing RateLimit resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RateLimitState, opts?: CustomResourceOptions): RateLimit
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
action: Optional[RateLimitActionArgs] = None,
bypasses: Optional[Sequence[RateLimitBypassArgs]] = None,
description: Optional[str] = None,
disabled: Optional[bool] = None,
match: Optional[RateLimitMatchArgs] = None,
period: Optional[float] = None,
threshold: Optional[float] = None,
zone_id: Optional[str] = None) -> RateLimit
func GetRateLimit(ctx *Context, name string, id IDInput, state *RateLimitState, opts ...ResourceOption) (*RateLimit, error)
public static RateLimit Get(string name, Input<string> id, RateLimitState? state, CustomResourceOptions? opts = null)
public static RateLimit get(String name, Output<String> id, RateLimitState state, CustomResourceOptions options)
resources: _: type: cloudflare:RateLimit get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Action
Rate
Limit Action - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- Bypasses
List<Rate
Limit Bypass> - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- Description string
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- Disabled bool
- When true, indicates that the rate limit is currently disabled.
- Match
Rate
Limit Match - Determines which traffic the rate limit counts towards the threshold.
- Period double
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- Threshold double
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - Zone
Id string - Identifier
- Action
Rate
Limit Action Args - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- Bypasses
[]Rate
Limit Bypass Args - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- Description string
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- Disabled bool
- When true, indicates that the rate limit is currently disabled.
- Match
Rate
Limit Match Args - Determines which traffic the rate limit counts towards the threshold.
- Period float64
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- Threshold float64
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - Zone
Id string - Identifier
- action
Rate
Limit Action - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- bypasses
List<Rate
Limit Bypass> - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description String
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled Boolean
- When true, indicates that the rate limit is currently disabled.
- match
Rate
Limit Match - Determines which traffic the rate limit counts towards the threshold.
- period Double
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold Double
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone
Id String - Identifier
- action
Rate
Limit Action - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- bypasses
Rate
Limit Bypass[] - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description string
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled boolean
- When true, indicates that the rate limit is currently disabled.
- match
Rate
Limit Match - Determines which traffic the rate limit counts towards the threshold.
- period number
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold number
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone
Id string - Identifier
- action
Rate
Limit Action Args - The action to perform when the threshold of matched traffic within the configured period is exceeded.
- bypasses
Sequence[Rate
Limit Bypass Args] - Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description str
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled bool
- When true, indicates that the rate limit is currently disabled.
- match
Rate
Limit Match Args - Determines which traffic the rate limit counts towards the threshold.
- period float
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold float
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone_
id str - Identifier
- action Property Map
- The action to perform when the threshold of matched traffic within the configured period is exceeded.
- bypasses List<Property Map>
- Criteria specifying when the current rate limit should be bypassed. You can specify that the rate limit should not apply to one or more URLs.
- description String
- An informative summary of the rate limit. This value is sanitized and any tags will be removed.
- disabled Boolean
- When true, indicates that the rate limit is currently disabled.
- match Property Map
- Determines which traffic the rate limit counts towards the threshold.
- period Number
- The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.
- threshold Number
- The threshold that will trigger the configured mitigation action. Configure this value along with the
period
property to establish a threshold per period. - zone
Id String - Identifier
Supporting Types
RateLimitAction, RateLimitActionArgs
- Mode string
- The action to perform. Available values: "simulate", "ban", "challenge", "jschallenge", "managedchallenge".
- Response
Rate
Limit Action Response - A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
- Timeout double
- The time in seconds during which Cloudflare will perform the mitigation action. Must be an integer value greater than or equal to the period. Notes: If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone's Challenge Passage time and you should not provide this value.
- Mode string
- The action to perform. Available values: "simulate", "ban", "challenge", "jschallenge", "managedchallenge".
- Response
Rate
Limit Action Response - A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
- Timeout float64
- The time in seconds during which Cloudflare will perform the mitigation action. Must be an integer value greater than or equal to the period. Notes: If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone's Challenge Passage time and you should not provide this value.
- mode String
- The action to perform. Available values: "simulate", "ban", "challenge", "jschallenge", "managedchallenge".
- response
Rate
Limit Action Response - A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
- timeout Double
- The time in seconds during which Cloudflare will perform the mitigation action. Must be an integer value greater than or equal to the period. Notes: If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone's Challenge Passage time and you should not provide this value.
- mode string
- The action to perform. Available values: "simulate", "ban", "challenge", "jschallenge", "managedchallenge".
- response
Rate
Limit Action Response - A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
- timeout number
- The time in seconds during which Cloudflare will perform the mitigation action. Must be an integer value greater than or equal to the period. Notes: If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone's Challenge Passage time and you should not provide this value.
- mode str
- The action to perform. Available values: "simulate", "ban", "challenge", "jschallenge", "managedchallenge".
- response
Rate
Limit Action Response - A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
- timeout float
- The time in seconds during which Cloudflare will perform the mitigation action. Must be an integer value greater than or equal to the period. Notes: If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone's Challenge Passage time and you should not provide this value.
- mode String
- The action to perform. Available values: "simulate", "ban", "challenge", "jschallenge", "managedchallenge".
- response Property Map
- A custom content type and reponse to return when the threshold is exceeded. The custom response configured in this object will override the custom error for the zone. This object is optional. Notes: If you omit this object, Cloudflare will use the default HTML error page. If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone challenge pages and you should not provide the "response" object.
- timeout Number
- The time in seconds during which Cloudflare will perform the mitigation action. Must be an integer value greater than or equal to the period. Notes: If "mode" is "challenge", "managedchallenge", or "jschallenge", Cloudflare will use the zone's Challenge Passage time and you should not provide this value.
RateLimitActionResponse, RateLimitActionResponseArgs
- Body string
- The response body to return. The value must conform to the configured content type.
- Content
Type string - The content type of the body. Must be one of the following:
text/plain
,text/xml
, orapplication/json
.
- Body string
- The response body to return. The value must conform to the configured content type.
- Content
Type string - The content type of the body. Must be one of the following:
text/plain
,text/xml
, orapplication/json
.
- body String
- The response body to return. The value must conform to the configured content type.
- content
Type String - The content type of the body. Must be one of the following:
text/plain
,text/xml
, orapplication/json
.
- body string
- The response body to return. The value must conform to the configured content type.
- content
Type string - The content type of the body. Must be one of the following:
text/plain
,text/xml
, orapplication/json
.
- body str
- The response body to return. The value must conform to the configured content type.
- content_
type str - The content type of the body. Must be one of the following:
text/plain
,text/xml
, orapplication/json
.
- body String
- The response body to return. The value must conform to the configured content type.
- content
Type String - The content type of the body. Must be one of the following:
text/plain
,text/xml
, orapplication/json
.
RateLimitBypass, RateLimitBypassArgs
RateLimitMatch, RateLimitMatchArgs
RateLimitMatchHeader, RateLimitMatchHeaderArgs
RateLimitMatchRequest, RateLimitMatchRequestArgs
- Methods List<string>
- The HTTP methods to match. You can specify a subset (for example,
['POST','PUT']
) or all methods (['_ALL_']
). This field is optional when creating a rate limit. - Schemes List<string>
- The HTTP schemes to match. You can specify one scheme (
['HTTPS']
), both schemes (['HTTP','HTTPS']
), or all schemes (['_ALL_']
). This field is optional. - Url string
- The URL pattern to match, composed of a host and a path such as
example.org/path*
. Normalization is applied before the pattern is matched.*
wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to*
to match all traffic to your zone.
- Methods []string
- The HTTP methods to match. You can specify a subset (for example,
['POST','PUT']
) or all methods (['_ALL_']
). This field is optional when creating a rate limit. - Schemes []string
- The HTTP schemes to match. You can specify one scheme (
['HTTPS']
), both schemes (['HTTP','HTTPS']
), or all schemes (['_ALL_']
). This field is optional. - Url string
- The URL pattern to match, composed of a host and a path such as
example.org/path*
. Normalization is applied before the pattern is matched.*
wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to*
to match all traffic to your zone.
- methods List<String>
- The HTTP methods to match. You can specify a subset (for example,
['POST','PUT']
) or all methods (['_ALL_']
). This field is optional when creating a rate limit. - schemes List<String>
- The HTTP schemes to match. You can specify one scheme (
['HTTPS']
), both schemes (['HTTP','HTTPS']
), or all schemes (['_ALL_']
). This field is optional. - url String
- The URL pattern to match, composed of a host and a path such as
example.org/path*
. Normalization is applied before the pattern is matched.*
wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to*
to match all traffic to your zone.
- methods string[]
- The HTTP methods to match. You can specify a subset (for example,
['POST','PUT']
) or all methods (['_ALL_']
). This field is optional when creating a rate limit. - schemes string[]
- The HTTP schemes to match. You can specify one scheme (
['HTTPS']
), both schemes (['HTTP','HTTPS']
), or all schemes (['_ALL_']
). This field is optional. - url string
- The URL pattern to match, composed of a host and a path such as
example.org/path*
. Normalization is applied before the pattern is matched.*
wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to*
to match all traffic to your zone.
- methods Sequence[str]
- The HTTP methods to match. You can specify a subset (for example,
['POST','PUT']
) or all methods (['_ALL_']
). This field is optional when creating a rate limit. - schemes Sequence[str]
- The HTTP schemes to match. You can specify one scheme (
['HTTPS']
), both schemes (['HTTP','HTTPS']
), or all schemes (['_ALL_']
). This field is optional. - url str
- The URL pattern to match, composed of a host and a path such as
example.org/path*
. Normalization is applied before the pattern is matched.*
wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to*
to match all traffic to your zone.
- methods List<String>
- The HTTP methods to match. You can specify a subset (for example,
['POST','PUT']
) or all methods (['_ALL_']
). This field is optional when creating a rate limit. - schemes List<String>
- The HTTP schemes to match. You can specify one scheme (
['HTTPS']
), both schemes (['HTTP','HTTPS']
), or all schemes (['_ALL_']
). This field is optional. - url String
- The URL pattern to match, composed of a host and a path such as
example.org/path*
. Normalization is applied before the pattern is matched.*
wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to*
to match all traffic to your zone.
RateLimitMatchResponse, RateLimitMatchResponseArgs
- Origin
Traffic bool - When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origintraffic" to "false" to avoid legacy behaviour interacting with the "responseheaders" property.
- Origin
Traffic bool - When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origintraffic" to "false" to avoid legacy behaviour interacting with the "responseheaders" property.
- origin
Traffic Boolean - When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origintraffic" to "false" to avoid legacy behaviour interacting with the "responseheaders" property.
- origin
Traffic boolean - When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origintraffic" to "false" to avoid legacy behaviour interacting with the "responseheaders" property.
- origin_
traffic bool - When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origintraffic" to "false" to avoid legacy behaviour interacting with the "responseheaders" property.
- origin
Traffic Boolean - When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional. Notes: This field is deprecated. Instead, use response headers and set "origintraffic" to "false" to avoid legacy behaviour interacting with the "responseheaders" property.
Import
$ pulumi import cloudflare:index/rateLimit:RateLimit example '<zone_id>/<rate_limit_id>'
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.