Create an account or zone ruleset
Creates a ruleset.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194Accepted Permissions (at least one required)
Mass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteTransform Rules WriteSelect Configuration WriteAccount WAF WriteAccount Rulesets WriteLogs WriteParametersExpand Collapse
params RulesetNewParams
Body param: The kind of the ruleset.
Body param: The phase of the ruleset.
Path param: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
Path param: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
Query param: Validates the request without persisting changes when set to true. Responses that normally return 200 return result: null; endpoints that normally return 204 continue to return 204.
Rules param.Field[[]RulesetNewParamsRule]OptionalBody param: The list of rules in the ruleset.
Body param: The list of rules in the ruleset.
type BlockRuleParam struct{…}
ExposedCredentialCheck BlockRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit BlockRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewParamsRulesRulesetsChallengeRule struct{…}
The action to perform when the rule matches.
ExposedCredentialCheck RulesetNewParamsRulesRulesetsChallengeRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewParamsRulesRulesetsChallengeRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type CompressResponseRuleParam struct{…}
ActionParameters CompressResponseRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
Algorithms []CompressResponseRuleActionParametersAlgorithmCustom order for compression algorithms.
Custom order for compression algorithms.
Name CompressResponseRuleActionParametersAlgorithmsNameOptionalName of the compression algorithm to enable.
Name of the compression algorithm to enable.
ExposedCredentialCheck CompressResponseRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit CompressResponseRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type DDoSDynamicRuleParam struct{…}
ExposedCredentialCheck DDoSDynamicRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit DDoSDynamicRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type ExecuteRuleParam struct{…}
ActionParameters ExecuteRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
MatchedData ExecuteRuleActionParametersMatchedDataOptionalThe configuration to use for matched data logging.
The configuration to use for matched data logging.
Overrides ExecuteRuleActionParametersOverridesOptionalA set of overrides to apply to the target ruleset.
A set of overrides to apply to the target ruleset.
An action to override all rules with. This option has lower precedence than rule and category overrides.
Categories []ExecuteRuleActionParametersOverridesCategoryOptionalA list of category-level overrides. This option has the second-highest precedence after rule-level overrides.
A list of category-level overrides. This option has the second-highest precedence after rule-level overrides.
SensitivityLevel ExecuteRuleActionParametersOverridesCategoriesSensitivityLevelOptionalThe sensitivity level to use for rules in the category. This option is only applicable for DDoS phases.
The sensitivity level to use for rules in the category. This option is only applicable for DDoS phases.
Whether to enable execution of all rules. This option has lower precedence than rule and category overrides.
Rules []ExecuteRuleActionParametersOverridesRuleOptionalA list of rule-level overrides. This option has the highest precedence.
A list of rule-level overrides. This option has the highest precedence.
SensitivityLevel ExecuteRuleActionParametersOverridesRulesSensitivityLevelOptionalThe sensitivity level to use for the rule. This option is only applicable for DDoS phases.
The sensitivity level to use for the rule. This option is only applicable for DDoS phases.
SensitivityLevel ExecuteRuleActionParametersOverridesSensitivityLevelOptionalA sensitivity level to set for all rules. This option has lower precedence than rule and category overrides and is only applicable for DDoS phases.
A sensitivity level to set for all rules. This option has lower precedence than rule and category overrides and is only applicable for DDoS phases.
ExposedCredentialCheck ExecuteRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit ExecuteRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type ForceConnectionCloseRuleParam struct{…}
ExposedCredentialCheck ForceConnectionCloseRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit ForceConnectionCloseRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewParamsRulesRulesetsJSChallengeRule struct{…}
The action to perform when the rule matches.
ExposedCredentialCheck RulesetNewParamsRulesRulesetsJSChallengeRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewParamsRulesRulesetsJSChallengeRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type LogRuleParam struct{…}
ExposedCredentialCheck LogRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit LogRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type LogCustomFieldRuleParam struct{…}
ActionParameters LogCustomFieldRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
RawResponseFields []LogCustomFieldRuleActionParametersRawResponseFieldOptionalThe raw response fields to log.
The raw response fields to log.
RequestFields []LogCustomFieldRuleActionParametersRequestFieldOptionalThe raw request fields to log.
The raw request fields to log.
ExposedCredentialCheck LogCustomFieldRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit LogCustomFieldRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type ManagedChallengeRuleParam struct{…}
ExposedCredentialCheck ManagedChallengeRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit ManagedChallengeRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RedirectRuleParam struct{…}
ActionParameters RedirectRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
FromValue RedirectRuleActionParametersFromValueOptionalA redirect based on the request properties.
A redirect based on the request properties.
StatusCode RedirectRuleActionParametersFromValueStatusCodeOptionalThe status code to use for the redirect.
The status code to use for the redirect.
ExposedCredentialCheck RedirectRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RedirectRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RewriteRuleParam struct{…}
ActionParameters RewriteRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
Headers map[string, RewriteRuleActionParametersHeader]OptionalA map of headers to rewrite.
A map of headers to rewrite.
type RewriteRuleActionParametersHeadersAddStaticHeaderParam struct{…}A header with a static value to add.
A header with a static value to add.
type RewriteRuleActionParametersHeadersAddDynamicHeaderParam struct{…}A header with a dynamic value to add.
A header with a dynamic value to add.
type RewriteRuleActionParametersHeadersSetStaticHeaderParam struct{…}A header with a static value to set.
A header with a static value to set.
URI RewriteRuleActionParametersURIOptionalA URI path rewrite.
A URI path rewrite.
ExposedCredentialCheck RewriteRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RewriteRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RouteRuleParam struct{…}
ActionParameters RouteRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
ExposedCredentialCheck RouteRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RouteRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type ScoreRuleParam struct{…}
ExposedCredentialCheck ScoreRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit ScoreRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type ServeErrorRuleParam struct{…}
ActionParameters ServeErrorRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
type ServeErrorRuleActionParametersActionParametersContentParam struct{…}
ContentType ServeErrorRuleActionParametersActionParametersContentContentTypeOptionalThe content type header to set with the error response.
The content type header to set with the error response.
type ServeErrorRuleActionParametersActionParametersAssetParam struct{…}
ContentType ServeErrorRuleActionParametersActionParametersAssetContentTypeOptionalThe content type header to set with the error response.
The content type header to set with the error response.
ExposedCredentialCheck ServeErrorRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit ServeErrorRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewParamsRulesRulesetsSetCacheControlRule struct{…}
The action to perform when the rule matches.
ActionParameters RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
Immutable RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersImmutableOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersImmutableSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersImmutableSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersImmutableRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
MaxAge RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMaxAgeOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMaxAgeSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMaxAgeRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
MustRevalidate RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustRevalidateOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustRevalidateSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustRevalidateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
MustUnderstand RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustUnderstandOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustUnderstandSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustUnderstandRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
NoCache RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoCacheOptionalA cache-control directive configuration that accepts optional qualifiers (header names).
A cache-control directive configuration that accepts optional qualifiers (header names).
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoCacheSetDirective struct{…}Set the directive with optional qualifiers.
Set the directive with optional qualifiers.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoCacheSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoCacheRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
NoStore RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoStoreOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoStoreSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoStoreSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoStoreRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
NoTransform RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoTransformOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoTransformSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoTransformSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoTransformRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
Private RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPrivateOptionalA cache-control directive configuration that accepts optional qualifiers (header names).
A cache-control directive configuration that accepts optional qualifiers (header names).
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPrivateSetDirective struct{…}Set the directive with optional qualifiers.
Set the directive with optional qualifiers.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPrivateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPrivateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
ProxyRevalidate RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersProxyRevalidateOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersProxyRevalidateSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
Public RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPublicOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPublicSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPublicSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPublicRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersPublicRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
SMaxage RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersSMaxageOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersSMaxageSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersSMaxageSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersSMaxageRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
StaleIfError RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleIfErrorOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleIfErrorSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
StaleWhileRevalidate RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleWhileRevalidateOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewParamsRulesRulesetsSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
ExposedCredentialCheck RulesetNewParamsRulesRulesetsSetCacheControlRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewParamsRulesRulesetsSetCacheControlRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type SetCacheSettingsRuleParam struct{…}
ActionParameters SetCacheSettingsRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
A list of additional ports that caching should be enabled on.
BrowserTTL SetCacheSettingsRuleActionParametersBrowserTTLOptionalHow long client browsers should cache the response. Cloudflare cache purge will not purge content cached on client browsers, so high browser TTLs may lead to stale content.
How long client browsers should cache the response. Cloudflare cache purge will not purge content cached on client browsers, so high browser TTLs may lead to stale content.
Mode SetCacheSettingsRuleActionParametersBrowserTTLModeThe browser TTL mode.
The browser TTL mode.
Whether the request’s response from the origin is eligible for caching. Caching itself will still depend on the cache control header and your other caching configurations.
CacheKey SetCacheSettingsRuleActionParametersCacheKeyOptionalWhich components of the request are included in or excluded from the cache key Cloudflare uses to store the response in cache.
Which components of the request are included in or excluded from the cache key Cloudflare uses to store the response in cache.
Whether to separate cached content based on the visitor’s device type.
Whether to protect from web cache deception attacks, while allowing static assets to be cached.
CustomKey SetCacheSettingsRuleActionParametersCacheKeyCustomKeyOptionalWhich components of the request are included or excluded from the cache key.
Which components of the request are included or excluded from the cache key.
Cookie SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookieOptionalWhich cookies to include in the cache key.
Which cookies to include in the cache key.
Header SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeaderOptionalWhich headers to include in the cache key.
Which headers to include in the cache key.
A list of headers to check for the presence of. The presence of these headers is included in the cache key.
Host SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHostOptionalHow to use the host in the cache key.
How to use the host in the cache key.
QueryString SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringOptionalWhich query string parameters to include in or exclude from the cache key.
Which query string parameters to include in or exclude from the cache key.
CacheReserve SetCacheSettingsRuleActionParametersCacheReserveOptionalSettings to determine whether the request’s response from origin is eligible for Cache Reserve (requires a Cache Reserve add-on plan).
Settings to determine whether the request’s response from origin is eligible for Cache Reserve (requires a Cache Reserve add-on plan).
EdgeTTL SetCacheSettingsRuleActionParametersEdgeTTLOptionalHow long the Cloudflare edge network should cache the response.
How long the Cloudflare edge network should cache the response.
Mode SetCacheSettingsRuleActionParametersEdgeTTLModeThe edge TTL mode.
The edge TTL mode.
StatusCodeTTL []SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLOptionalA list of TTLs to apply to specific status codes or status code ranges.
A list of TTLs to apply to specific status codes or status code ranges.
Whether to generate Cloudflare error pages for issues from the origin server.
OriginRangeRequests SetCacheSettingsRuleActionParametersOriginRangeRequestsOptionalControls whether Cloudflare fetches a large asset from the origin as a series of range requests instead of one whole-body request.
Controls whether Cloudflare fetches a large asset from the origin as a series of range requests instead of one whole-body request.
Mode SetCacheSettingsRuleActionParametersOriginRangeRequestsModeWhether to use range requests. default is the behaviour the zone gets without this rule.
Whether to use range requests. default is the behaviour the zone gets without this rule.
A timeout value between two successive read operations to use for your origin server. Historically, the timeout value between two read options from Cloudflare to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 errors because of timeouts from an origin server, try increasing this timeout value.
Whether Cloudflare should respect strong ETag (entity tag) headers. If false, Cloudflare converts strong ETag headers to weak ETag headers.
ServeStale SetCacheSettingsRuleActionParametersServeStaleOptionalWhen to serve stale content from cache.
When to serve stale content from cache.
SharedDictionary SetCacheSettingsRuleActionParametersSharedDictionaryOptionalConfiguration for shared dictionary compression. When set, Cloudflare injects Use-As-Dictionary headers on matching cacheable responses.
Configuration for shared dictionary compression. When set, Cloudflare injects Use-As-Dictionary headers on matching cacheable responses.
Whether to strip Last-Modified headers from the origin response before caching.
Whether to strip Set-Cookie headers from the origin response before caching.
Vary SetCacheSettingsRuleActionParametersVaryOptionalControls how cached responses vary based on request headers. default is required by the API and applies to any Vary response header that does not have a per-header override.
Controls how cached responses vary based on request headers. default is required by the API and applies to any Vary response header that does not have a per-header override.
Default SetCacheSettingsRuleActionParametersVaryDefaultOptionalControls how response Vary headers without a per-header override contribute to the cache key.
Controls how response Vary headers without a per-header override contribute to the cache key.
Action SetCacheSettingsRuleActionParametersVaryDefaultActionHow the header value is treated when building the cache key.
How the header value is treated when building the cache key.
Headers map[string, SetCacheSettingsRuleActionParametersVaryHeader]OptionalA mapping of lowercase request header names to their vary configuration.
A mapping of lowercase request header names to their vary configuration.
Action SetCacheSettingsRuleActionParametersVaryHeadersActionHow the header value is treated when building the cache key.
How the header value is treated when building the cache key.
ExposedCredentialCheck SetCacheSettingsRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit SetCacheSettingsRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewParamsRulesRulesetsSetCacheTagsRule struct{…}
The action to perform when the rule matches.
ActionParameters RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
type RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersAddCacheTagsValues struct{…}Add cache tags using a list of values.
Add cache tags using a list of values.
Operation RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersAddCacheTagsValuesOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersAddCacheTagsExpression struct{…}Add cache tags using an expression.
Add cache tags using an expression.
Operation RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersRemoveCacheTagsValues struct{…}Remove cache tags using a list of values.
Remove cache tags using a list of values.
Operation RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersRemoveCacheTagsExpression struct{…}Remove cache tags using an expression.
Remove cache tags using an expression.
Operation RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersSetCacheTagsValues struct{…}Set cache tags using a list of values.
Set cache tags using a list of values.
Operation RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersSetCacheTagsValuesOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersSetCacheTagsExpression struct{…}Set cache tags using an expression.
Set cache tags using an expression.
Operation RulesetNewParamsRulesRulesetsSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
ExposedCredentialCheck RulesetNewParamsRulesRulesetsSetCacheTagsRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewParamsRulesRulesetsSetCacheTagsRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type SetConfigRuleParam struct{…}
ActionParameters SetConfigRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
Autominify SetConfigRuleActionParametersAutominifyOptionalWhich file extensions to minify automatically.
Which file extensions to minify automatically.
Cloudflare Apps are deprected.
Whether to disable Cloudflare Apps.
Whether to disable Pay Per Crawl.
Whether to disable Real User Monitoring (RUM).
Mirage is deprecated. More information at https://developers.cloudflare.com/speed/optimization/images/mirage/.
Whether to enable Mirage.
Polish SetConfigRuleActionParametersPolishOptionalThe Polish level to configure.
The Polish level to configure.
Whether to redirect verified AI training crawlers to canonical URLs found in the HTML response.
RequestBodyBuffering SetConfigRuleActionParametersRequestBodyBufferingOptionalThe request body buffering mode.
The request body buffering mode.
ResponseBodyBuffering SetConfigRuleActionParametersResponseBodyBufferingOptionalThe response body buffering mode.
The response body buffering mode.
SecurityLevel SetConfigRuleActionParametersSecurityLevelOptionalThe Security Level to configure.
The Security Level to configure.
ExposedCredentialCheck SetConfigRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit SetConfigRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type SkipRuleParam struct{…}
ActionParameters SkipRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
A phase to skip the execution of. This option is only compatible with the products option.
A list of phases to skip the execution of. This option is incompatible with the rulesets option.
A list of phases to skip the execution of. This option is incompatible with the rulesets option.
Products []SkipRuleActionParametersProductOptionalA list of legacy security products to skip the execution of.
A list of legacy security products to skip the execution of.
A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the execution of. This option is incompatible with the ruleset option.
ExposedCredentialCheck SkipRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit SkipRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewParamsRulesRulesetsTransformResponseHTMLRule struct{…}
The action to perform when the rule matches.
ActionParameters RulesetNewParamsRulesRulesetsTransformResponseHTMLRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
ExposedCredentialCheck RulesetNewParamsRulesRulesetsTransformResponseHTMLRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewParamsRulesRulesetsTransformResponseHTMLRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
ReturnsExpand Collapse
type RulesetNewResponseEnvelopeResult interface{…}A result.
A result.
type RulesetNewResponseEnvelopeResult struct{…}A ruleset object.
A ruleset object.
Kind KindThe kind of the ruleset.
The kind of the ruleset.
Phase PhaseThe phase of the ruleset.
The phase of the ruleset.
Rules []RulesetNewResponseEnvelopeResultRulesThe list of rules in the ruleset.
The list of rules in the ruleset.
type RulesetNewResponseEnvelopeResultRulesChallengeRule struct{…}
The action to perform when the rule matches.
ExposedCredentialCheck RulesetNewResponseEnvelopeResultRulesChallengeRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewResponseEnvelopeResultRulesChallengeRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewResponseEnvelopeResultRulesJavaScriptChallengeRule struct{…}
The action to perform when the rule matches.
ExposedCredentialCheck RulesetNewResponseEnvelopeResultRulesJavaScriptChallengeRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewResponseEnvelopeResultRulesJavaScriptChallengeRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRule struct{…}
The action to perform when the rule matches.
ActionParameters RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
Immutable RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersImmutableOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersImmutableSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersImmutableSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersImmutableRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
MaxAge RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMaxAgeOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMaxAgeSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
MustRevalidate RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustRevalidateOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustRevalidateSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
MustUnderstand RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustUnderstandOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustUnderstandSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
NoCache RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoCacheOptionalA cache-control directive configuration that accepts optional qualifiers (header names).
A cache-control directive configuration that accepts optional qualifiers (header names).
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoCacheSetDirective struct{…}Set the directive with optional qualifiers.
Set the directive with optional qualifiers.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoCacheSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoCacheRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
NoStore RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoStoreOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoStoreSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoStoreSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoStoreRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
NoTransform RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoTransformOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoTransformSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoTransformSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoTransformRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
Private RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPrivateOptionalA cache-control directive configuration that accepts optional qualifiers (header names).
A cache-control directive configuration that accepts optional qualifiers (header names).
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPrivateSetDirective struct{…}Set the directive with optional qualifiers.
Set the directive with optional qualifiers.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPrivateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPrivateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
ProxyRevalidate RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersProxyRevalidateOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
Public RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPublicOptionalA cache-control directive configuration.
A cache-control directive configuration.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPublicSetDirective struct{…}Set the directive.
Set the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPublicSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPublicRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersPublicRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
SMaxage RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersSMaxageOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersSMaxageSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersSMaxageSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersSMaxageRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
StaleIfError RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleIfErrorOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
StaleWhileRevalidate RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleWhileRevalidateOptionalA cache-control directive configuration that accepts a duration value in seconds.
A cache-control directive configuration that accepts a duration value in seconds.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective struct{…}Set the directive with a duration value in seconds.
Set the directive with a duration value in seconds.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
type RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective struct{…}Remove the directive.
Remove the directive.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperationThe operation to perform on the cache-control directive.
The operation to perform on the cache-control directive.
ExposedCredentialCheck RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewResponseEnvelopeResultRulesSetCacheControlRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRule struct{…}
The action to perform when the rule matches.
ActionParameters RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersAddCacheTagsValues struct{…}Add cache tags using a list of values.
Add cache tags using a list of values.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersAddCacheTagsExpression struct{…}Add cache tags using an expression.
Add cache tags using an expression.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValues struct{…}Remove cache tags using a list of values.
Remove cache tags using a list of values.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpression struct{…}Remove cache tags using an expression.
Remove cache tags using an expression.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersSetCacheTagsValues struct{…}Set cache tags using a list of values.
Set cache tags using a list of values.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
type RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersSetCacheTagsExpression struct{…}Set cache tags using an expression.
Set cache tags using an expression.
Operation RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperationThe operation to perform on the cache tags.
The operation to perform on the cache tags.
ExposedCredentialCheck RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewResponseEnvelopeResultRulesSetCacheTagsRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
type RulesetNewResponseEnvelopeResultRulesTransformResponseHTMLRule struct{…}
The action to perform when the rule matches.
ActionParameters RulesetNewResponseEnvelopeResultRulesTransformResponseHTMLRuleActionParametersOptionalThe parameters configuring the rule’s action.
The parameters configuring the rule’s action.
ExposedCredentialCheck RulesetNewResponseEnvelopeResultRulesTransformResponseHTMLRuleExposedCredentialCheckOptionalConfiguration for exposed credential checking.
Configuration for exposed credential checking.
Ratelimit RulesetNewResponseEnvelopeResultRulesTransformResponseHTMLRuleRatelimitOptionalAn object configuring the rule’s rate limit behavior.
An object configuring the rule’s rate limit behavior.
Characteristics of the request on which the rate limit counter will be incremented.
An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.
Period of time in seconds after which the action will be disabled following its first execution.
The threshold of requests per period after which the action will be executed for the first time.
Create an account or zone ruleset
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/rulesets"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
ruleset, err := client.Rulesets.New(context.TODO(), rulesets.RulesetNewParams{
Kind: cloudflare.F(rulesets.KindRoot),
Name: cloudflare.F("My ruleset"),
Phase: cloudflare.F(rulesets.PhaseHTTPRequestFirewallCustom),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", ruleset)
}
{
"errors": [
{
"message": "something bad happened",
"code": 10000,
"source": {
"pointer": "/rules/0/action"
}
}
],
"messages": [
{
"message": "something bad happened",
"code": 10000,
"source": {
"pointer": "/rules/0/action"
}
}
],
"result": {
"id": "2f2feab2026849078ba485f918791bdc",
"kind": "root",
"last_updated": "2000-01-01T00:00:00Z",
"name": "My ruleset",
"phase": "http_request_firewall_custom",
"rules": [
{
"last_updated": "2000-01-01T00:00:00Z",
"version": "1",
"id": "id",
"action": "action",
"action_parameters": {
"response": {
"content": "{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}",
"content_type": "application/json",
"status_code": 400
}
},
"categories": [
"directory-traversal"
],
"description": "Block the request.",
"enabled": true,
"exposed_credential_check": {
"password_expression": "url_decode(http.request.body.form[\\\"password\\\"][0])",
"username_expression": "url_decode(http.request.body.form[\\\"username\\\"][0])"
},
"expression": "expression",
"logging": {
"enabled": true
},
"ratelimit": {
"characteristics": [
"cf.colo.id"
],
"period": 60,
"counting_expression": "http.request.body.raw eq \"abcd\"",
"mitigation_timeout": 600,
"requests_per_period": 1000,
"requests_to_origin": true,
"score_per_period": 400,
"score_response_header_name": "my-score"
},
"ref": "ref"
}
],
"version": "1",
"description": "A description for my ruleset."
},
"success": true
}Returns Examples
{
"errors": [
{
"message": "something bad happened",
"code": 10000,
"source": {
"pointer": "/rules/0/action"
}
}
],
"messages": [
{
"message": "something bad happened",
"code": 10000,
"source": {
"pointer": "/rules/0/action"
}
}
],
"result": {
"id": "2f2feab2026849078ba485f918791bdc",
"kind": "root",
"last_updated": "2000-01-01T00:00:00Z",
"name": "My ruleset",
"phase": "http_request_firewall_custom",
"rules": [
{
"last_updated": "2000-01-01T00:00:00Z",
"version": "1",
"id": "id",
"action": "action",
"action_parameters": {
"response": {
"content": "{\n \"success\": false,\n \"error\": \"you have been blocked\"\n}",
"content_type": "application/json",
"status_code": 400
}
},
"categories": [
"directory-traversal"
],
"description": "Block the request.",
"enabled": true,
"exposed_credential_check": {
"password_expression": "url_decode(http.request.body.form[\\\"password\\\"][0])",
"username_expression": "url_decode(http.request.body.form[\\\"username\\\"][0])"
},
"expression": "expression",
"logging": {
"enabled": true
},
"ratelimit": {
"characteristics": [
"cf.colo.id"
],
"period": 60,
"counting_expression": "http.request.body.raw eq \"abcd\"",
"mitigation_timeout": 600,
"requests_per_period": 1000,
"requests_to_origin": true,
"score_per_period": 400,
"score_response_header_name": "my-score"
},
"ref": "ref"
}
],
"version": "1",
"description": "A description for my ruleset."
},
"success": true
}