Docs / Reference / Rules
ConfigurationRule
ConfigurationRule manages one configuration rule in a zone: settings, such as the SSL mode or the security level, changed for the requests its expression matches.
- API version
- kflare.dev/v1alpha1
- Scope
- Namespaced
- Short name
- cfconfig
- Token permission
- Zone · Config Rules · Edit
Example
Every field, with the sample's values. The live lines are the repository's sample, which applies as it is; the commented ones are the other fields, filled from other samples where one sets them. Some exclude each other, so check the rules before you uncomment several.
apiVersion: kflare.dev/v1alpha1
kind: ConfigurationRule
metadata:
name: example-configurationrule
namespace: default
spec:
zoneRef:
name: example-zone
expression: starts_with(http.request.uri.path, "/admin/")
description: Challenge more readily, and leave scripts alone, on the admin pages
bic: true
rocketLoader: false
securityLevel: high
ssl: strict
# automaticHTTPSRewrites: true
# contentConverter: true
# disableRUM: true
# disableZaraz: true
# emailObfuscation: true
# enabled: true
# fonts: true
# hotlinkProtection: true
# opportunisticEncryption: true
# polish: "off" # one of: off, lossless, lossy, webp
# priority: 1
# redirectsForAITraining: true
# requestBodyBuffering: none # one of: none, standard, full
# responseBodyBuffering: none # one of: none, standard
# serverSideExcludes: true
# webmcpEnabled: true
# webmcpPacks:
# - <webmcpPacks>Spec
What you set, with the limits the API server enforces.
| Field | Description |
|---|---|
automaticHTTPSRewritesboolean | AutomaticHTTPSRewrites rewrites links to HTTP URLs in HTML responses to HTTPS. |
bicboolean | BIC turns Browser Integrity Check on or off: it challenges requests whose headers spammers and bots commonly abuse. |
contentConverterboolean | ContentConverter converts content, such as HTML to Markdown, for the clients that ask for it. Free plans may only turn it off. |
descriptionstring | Description is shown with the rule in the Cloudflare dashboard. Limits: at most 4096 characters |
disableRUMboolean | DisableRUM turns Real User Monitoring off. It takes only true. One of: |
disableZarazboolean | DisableZaraz turns Zaraz off. It takes only true. One of: |
emailObfuscationboolean | EmailObfuscation hides the email addresses in HTML responses from bots. |
enabledboolean | Enabled turns the rule on or off without deleting it. Default: |
expressionstringrequired | Expression selects the requests the rule applies to, in Cloudflare's Rules language, for example Limits: 1 to 4096 characters |
fontsboolean | Fonts serves the page's Google Fonts from Cloudflare (Cloudflare Fonts). |
hotlinkProtectionboolean | HotlinkProtection stops other sites from embedding the zone's images. |
opportunisticEncryptionboolean | OpportunisticEncryption lets browsers fetch HTTP URLs over an encrypted connection. |
polishstring | Polish is how Cloudflare optimizes images: off, lossless, lossy or webp. Free plans may only turn it off; quote off in YAML, which would read it as a boolean. One of: |
priorityinteger | Priority orders the rules kflare manages in a zone and phase: lower runs first, and rules with the same priority run in order of namespace and name. Rules created outside kflare keep their place. Limits: format |
redirectsForAITrainingboolean | RedirectsForAITraining redirects verified AI training crawlers to the canonical URLs the HTML response names. Free plans may only turn it off. |
requestBodyBufferingstring | RequestBodyBuffering is how much of a request's body Cloudflare buffers before the origin gets it: none, standard or full. One of: |
responseBodyBufferingstring | ResponseBodyBuffering is how much of a response's body Cloudflare buffers: none or standard. One of: |
rocketLoaderboolean | RocketLoader loads the page's JavaScript without blocking its rendering. |
securityLevelstring | SecurityLevel is how readily Cloudflare challenges visitors by their IP address's reputation, from essentially_off to under_attack. Free plans may not turn it off. One of: |
serverSideExcludesboolean | ServerSideExcludes hides the content an HTML response marks with SSE tags from suspicious visitors. |
sslstring | SSL is how Cloudflare connects to the origin: off, flexible (HTTP), full (HTTPS, any certificate), strict (HTTPS, a valid certificate) or origin_pull. Free plans may not use origin_pull; quote off in YAML. One of: |
webmcpEnabledboolean | WebmcpEnabled serves the WebMCP bridge script, which exposes the page's tools to browser AI agents. |
webmcpPacks[]string | WebmcpPacks are the WebMCP tool packs to turn on for the requests the rule matches, at most 100. They do not serve the bridge script itself. Unset, the packs stay as they are: kflare does not send an empty list, which would turn them all off. Limits: at most 100 items; 1 to 128 characters; matches |
zoneRefobjectrequiredimmutable | ZoneRef references the Zone, in the same namespace, the rule belongs to. Immutable after creation. |
zoneRef.namestring | Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names Default: |
Rules
Checked across fields when the resource is applied.
- must set at least one of automaticHTTPSRewrites, bic, contentConverter, disableRUM, disableZaraz, emailObfuscation, fonts, hotlinkProtection, opportunisticEncryption, polish, redirectsForAITraining, requestBodyBuffering, responseBodyBuffering, rocketLoader, securityLevel, serverSideExcludes, ssl, webmcpEnabled and webmcpPacks
Status
What kflare reports. conditions holds the Ready condition, whose reason says why a resource isn't ready.
| Field | Description |
|---|---|
cloudflareMetadataobject | CloudflareMetadata identifies the rule in Cloudflare. |
cloudflareMetadata.refstring | Ref is the rule's ref, which kflare derives from the resource's kind, namespace and name. kflare finds the rule it manages by its ref. |
cloudflareMetadata.ruleIDstring | RuleID is the rule's Cloudflare ID. |
cloudflareMetadata.rulesetIDstring | RulesetID is the zone's entry point ruleset for the rule's phase. |
cloudflareMetadata.versionstring | Version is the rule's version, which Cloudflare increments whenever the rule changes. |
cloudflareMetadata.zoneIDstring | ZoneID is the Cloudflare zone the rule is in. |
conditions[]object | Conditions represent the latest available observations of the rule's state. |
kubectl get
The columns kubectl get configurationrules prints.
| Column | Source |
|---|---|
| PRIORITY | .spec.priority |
| RULE ID | .status.cloudflareMetadata.ruleID |
| READY | .status.conditions[?(@.type=="Ready")].status |
| AGE | .metadata.creationTimestamp |
Samples
From the repository's config/samples, comments included.
# Generated by kflare-gen from generator/generator.yaml. DO NOT EDIT.
#
# ConfigurationRule is the Schema for the configurationrules API.
# It manages one configuration rule in a zone: settings, such as the SSL
# mode or the security level, changed for the requests its expression
# matches.
apiVersion: kflare.dev/v1alpha1
kind: ConfigurationRule
metadata:
name: example-configurationrule
namespace: default
spec:
zoneRef:
name: example-zone
expression: starts_with(http.request.uri.path, "/admin/")
description: Challenge more readily, and leave scripts alone, on the admin pages
bic: true
rocketLoader: false
securityLevel: high
ssl: strict