Table: cloudflare_page_rule - Query Cloudflare Page Rules using SQL
Cloudflare Page Rules is a feature within Cloudflare that allows you to customize your website's functionality and performance on a page-by-page basis. It provides a centralized way to set up and manage rules for various web pages, including redirection, caching, security, and more. Cloudflare Page Rules helps you optimize the delivery of your web content and take appropriate actions when predefined conditions are met.
Table Usage Guide
The cloudflare_page_rule
table provides insights into the rules set up for specific web pages within Cloudflare. As a DevOps engineer, explore rule-specific details through this table, including targets, actions, and associated metadata. Utilize it to uncover information about rules, such as those related to caching, security, or redirection, and the verification of their correct implementation.
Examples
Basic info
Explore which rules are active within your Cloudflare settings to prioritize their importance and manage your web traffic effectively. This can help optimize your website's performance and security.
select id, zone_id, status, priorityfrom cloudflare_page_rule;
select id, zone_id, status, priorityfrom cloudflare_page_rule;
List disabled page rules
Explore which page rules are currently disabled in your Cloudflare settings. This information can help you understand potential vulnerabilities or areas of your website that are not currently protected by active rules.
select id, zone_id, statusfrom cloudflare_page_rulewhere status = 'disabled';
select id, zone_id, statusfrom cloudflare_page_rulewhere status = 'disabled';
List page rules that do not have the Always Online feature enabled
Assess the elements within your website's page rules to identify those that lack the Always Online feature. This can be useful to ensure your site remains accessible even when your server goes offline, enhancing user experience and site reliability.
select id, zone_id, action ->> 'value' as always_onlinefrom cloudflare_page_rule, jsonb_array_elements(actions) as actionwhere action ->> 'id' = 'always_online' and action ->> 'value' = 'off';
select id, zone_id, json_extract(action.value, '$.value') as always_onlinefrom cloudflare_page_rule, json_each(actions) as actionwhere json_extract(action.value, '$.id') = 'always_online' and json_extract(action.value, '$.value') = 'off';
Schema for cloudflare_page_rule
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
actions | jsonb | A list of actions to perform if the targets of this rule match the request. Actions can redirect the url to another url or override settings (but not both). | |
created_on | timestamp with time zone | The time when the page rule is created. | |
id | text | = | Specifies the Page Rule identifier. |
modified_on | timestamp with time zone | The time when the page rule was last modified. | |
priority | bigint | A number that indicates the preference for a page rule over another. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | text | Specifies the status of the page rule. | |
targets | jsonb | A list of targets to evaluate on a request. | |
title | text | Title of the resource. | |
user_id | text | =, !=, ~~, ~~*, !~~, !~~* | ID of the current user. |
zone_id | text | = | Specifies the zone identifier. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- cloudflare
You can pass the configuration to the command with the --config
argument:
steampipe_export_cloudflare --config '<your_config>' cloudflare_page_rule