- Cloudflare page rules API Reference. Overview. Apply and verify the changes A wildcard (*) in a page rule URL will match even if no characters are present and may include any part of the URL, including the query string. Overview; 1. ACM. Cloudflare API Go. The previous two blog posts have outlined how you can turn off CloudFlare's features based on URL patterns, or accomplish advanced URL forwarding. Customers customize CloudFlare with Page Rules based on their specific needs, including changing or Page Rules will not apply to subdomains that do not exist in DNS or are not being directed to Cloudflare. Search. CDN-Cache-Control and Cloudflare-CDN-Cache-Control – Enables users to have detailed control over cache TTLs without using a page rule. For example, if you have a catch-all Page Rule (rule A: /images/*) but want a more specific Page Rule to take precedence (rule B: /images/special/*), specify a higher priority for rule B so it overrides rule A. Transform Rules. The most common reason that a page rule is not working — such as URL forwarding — is that the page rule you created is on a record that is not proxied by Cloudflare in your DNS settings. The rule filter expression defines the scope of the rule and the rule action defines what happens when there is a match for the expression. Changes to redirects will be updated to your website at build time so make sure you commit and push Cloudflare Pages sites can contain up to 20,000 files. If you need to modify the path also, you will need to either use a Worker or combine the page rule with a For example, if multiple rules with the Redirect action match, Cloudflare will always use the URL redirect of the first rule that matches. Alerting. It helps improve site performance, reliability, security, and user experience. Select Save and Deploy Page Rule. Preview and merge the changes; 3. Finish the updates to your subscription. There are hundreds of these around the world, each of which are capable of running services like Workers and Page Rules. You can also modify, remove, and prioritize the rules from the Go to Rules > Page Rules. Page Rules require a “proxied” DNS record for your page rules to work. Reference wildcard matches You can reference a matched wildcard later using the $<X> syntax, where <X> indicates the index of a glob pattern. They can help you save bandwidth, improve security, bypass Cloudflare’s caching where it’s not needed (eg. Page rules let you customize Cloudflare’s functionality to match your needs. Page Rules are available in Rules > Page Rules. Abuse Reports. In other words, you have to have your DNS running through Cloudflare’s DNS service and proxied for Cloudflare to cache your site to its CDN service. For example, consider the following ruleset with four rules (R1, R2, R3, and R4). One million Page Rules have been deployed in the past three months alone. your admin area), and even prevent spam bots from collecting your email address. The configuration of the updated Page Rule will exactly match the data passed in the API request. Products Learning Status Support Log in. For Pick a Setting, select a Page rules are prioritized in descending order in the Cloudflare dashboard, with the highest priority rule at the top. Also, if you configure URL redirects using different Cloudflare products (Single Redirects and Bulk Redirects), the product executed first will apply, if there is a rule match (in this case, Single Redirects). Cache Rules allows you to make adjustments to what is eligible to cache, how long it should be cached and where, as well as trigger specific interactions with Cloudflare’s cache and other Rules products for To use redirects on Cloudflare Pages, declare your redirects in a plain text file called _redirects without a file extension, in the output folder of your project. Disable compression for AVIF images Create a compression rule to turn off compression for AVIF images, based on either the content type or the file extension specified in the request. You can define a page rule to trigger one or more actions whenever a certain URL pattern is matched. Generally speaking, for non-terminating actions the last change made by rules in the same phase will win (later rules can overwrite changes In the last blog post, I introduced Page Rules and showed how you could use it to control CloudFlare's features like Apps, Performance, and Security settings on a page-by-page basis. Domain types. Follow this workflow to create a configuration rule for a given zone via API: Use the List zone rulesets operation to check if there is already a ruleset for the http_config_settings phase at the zone level. The new feature allows you to customize behavior on a page-by-page basis. Overview; Bypass Cache on Cookie setting; When saving a page rule, Cloudflare will ensure that there is a slash after each occurrence of the current zone name in the If the URL matches field. The Create Page Rule for <your domain> dialog opens. Serve a custom maintenance page instead of fetching content from the origin server or cache. Click the Rules app. Overview; Examples; Configuration Rules. Under If the URL matches, enter the URL or URL pattern that should match the rule. Select the domain where you want to add the page rule. File size. Interact with Cloudflare's products and services via the Cloudflare API. Rules . On this page. yoursitename. In the new ruleset properties, set the following values: Use Cache Rules to customize cache settings on Cloudflare. API Gateway. AI Gateway. Addressing. The different types of rules listed above will take precedence over Page Rules. A rule defines a filter and an action to perform on the incoming requests that match the filter. A simple interface with wildcard support makes it easy to define source and target URL patterns without needing complex functions or regular expressions, efficiently handling thousands of URLs with a single rule. Select Create Page Rule. Page Rules migration guide; Changelog; Products Learning Status Support Log in. Page Rules are limited to filtering on a URL, or a URL with asterisks as wildcards. For managing larger headers, it is Interact with Cloudflare's products and services via the Cloudflare API. This means that Page Rules will be overridden if there is a match for both Page Rules and the Rules products listed above. In the Page Rules tab, click Create Page Rule. The configuration of the updated Page Rule will exactly match the data passed in To configure Transform Rules in the dashboard, go to the Transform Rules page in Rules. This page rule is helpful for pages that can generate Captchas or nonces. . The Resolve Override setting only allows override of the hostname, not the path. This feature is currently available for domains on the Enterprise plan. Cloudflare Dashboard Discord Community Learning Center Support Portal. Today we're releasing a whole suite of upgrades to page rules: API support, additional settings, pausing a page rule and a mobile-friendly design. Cloudflare recommends ordering your rules from most specific to least To configure URL forwarding or redirects using Page Rules: Log into your Cloudflare account. Append dates to cookies to use with A/B testing. Now, We have spent the last ten years learning how customers use Page Rules to customize their cached content, and it’s clear the time is ripe for evolving rules-based caching on Cloudflare. For URL, enter the URL or URL pattern that should match the rule (more details about wildcard matching). GitHub X YouTube. Dynamic Redirects is built atop our lightning-fast Create a compression rule to turn off Brotli compression for all incoming requests of a given zone. This evolution will allow for greater flexibility in caching different types of content through additional rule configurability, while providing more visibility into when and how The priority of the rule, used to define which Page Rule is processed over another. Many of these page rules were taken directly from Cloudflare’s Page Rule YouTube video. Skip to content. Support for regular expressions depends on your Cloudflare plan. Cloudflare Docs . The build output folder is project-specific, so the _redirects file should not always be in the root directory of the repository. Dynamically set a cookie Single Redirects allow you to create static or dynamic URL redirects. With Page Rules, you can do things like: Cache specific pages or assets for Cloudflare Page Rules allow you to control how Cloudflare manages traffic for specific URLs. Page Rules is the technology that allows you to configure your CloudFlare Network ports supported by Page Rules; Using Page Rules with Workers; Page Rules are case-insensitive; On this page. Headers. Cloudflare API HTTP. For Additional page rules, change the amount to your previous value. On Monday, CloudFlare officially announced Page Rules. The maximum file size for a single Cloudflare Pages site asset for serving these files. Create a new branch and append the page rule; 2. The other big difference between Dynamic Redirects and Page Rules is in the filtering. Replaces the configuration of an existing Page Rule. Overview; (part of Transform Rules) to add an X-Source HTTP header to the request with a static value (Cloudflare). If the phase ruleset does not exist, create it using the Create a zone ruleset operation. Warning. com) back to your apex domain (yoursitename. They can be used to customize settings like redirects, caching, and security for individual pages or sections of your website. Docs Feedback. Click the appropriate Cloudflare account for the domain where you want to add URL Cloudflare Page Rules is a powerful tool that allows you to modify your website performance by customizing how Cloudflare works for your domain. Here I'm going to explain how you can use the same Page Rules interface to enable URL forwarding. Looking to add the best Cloudflare page rules for WordPress?. Consider an example where you have a page rule that redirects a subdomain (subdomain. Dynamic URL redirects also support advanced features such as string replacement operations Page Rules are powerful tools for controlling how CloudFlare works on your site on a page-by-page basis. If you are over your current limit, you may have to delete existing page rules (paused or active). Page Rules trigger one or more actions whenever a certain URL pattern is matched. Select theme. Consider alternative Rules options due Cloudflare acts as a reverse proxy ↗ to provide services, like Page Rules, to Internet properties. Accounts. If you do not Use Cloudflare Page Rules to improve the user experience of your domain with hardened security and enhanced site performance, while increasing reliability and minimizing bandwidth usage for your origin server. Page Rules won’t apply to hostnames that don’t exist in DNS or aren’t being directed to Cloudflare. Your application's traffic will pass through a Cloudflare data center that is closest to the visitor. For more complex header modifications and rewrite logic, consider using Snippets. Cloudflare Transform Rules are available to all customers. Create rule in the dashboard; Create rule via API; Create rule using Terraform; Available settings Learn to create and edit page rules and understand the different settings available. In the 10 years since it launched, Page Rules has become a well established product, and a very well adopted one. Browser Cache TTL — APO applies custom Browser TTL. The priority of the rule, used to define which Page Rule is processed over another. Account & User Management. An individual header in a _headers file can have a maximum of 2,000 characters. URL forwarding was a surprise request from a number of early CloudFlare users. Docs Beta Feedback. A higher number indicates a higher priority. Ideal for downtime notifications, planned maintenance, or emergency messages. Rule filter expressions are defined using the Rules language. In the last blog post, I introduced Page Rules and showed how you could use it to control CloudFlare's features like Apps, Performance, and Security settings on a page-by-page basis. Body param: The priority of the rule, used to define which Page Rule is processed over another. The steps to create a page rule are: Log in to the Cloudflare dashboard. com). Page Rules are used to tune On this page. A _headers file can have a maximum of 100 header rules. In addition to the ability to these abilities, Page Rules also enables a powerful new Customers can rewrite Host headers using different Cloudflare rules. cloudflare_ page_ rule cloudflare_ pages_ domain cloudflare_ pages_ project cloudflare_ queue cloudflare_ r2_ bucket cloudflare_ rate_ limit cloudflare_ regional_ hostname cloudflare_ regional_ tiered_ cache cloudflare_ ruleset cloudflare_ spectrum_ application cloudflare_ Use the following resources to help you troubleshoot issues with Page Rules. aagmr twntg ifqzw ytvqi kxcp mfihxmz jbib alho udw lbgi