Cloudflare Phases Out Page Rules Feature

Joda StößerJoda Stößer
4 min read

It's been a long time coming, as Cloudflare wrote about the future deprecation and replacement of Page Rules back in 2022 in their blog article:

Introduction of Page Rules

Since their introduction in February 2012, they've garnered a huge amount of popularity and allowed users to control all kinds of settings for any URL and path.

Referencing the power of the apache2 configuration file read from the web root of sites, used by many web projects including WordPress and the likes to dynamically control the behaviour of the web server, Cloudflare described the feature like this:

The feature provides many of the most popular controls of HTACCESS with a user-friendly interface.

The amount of settings grew as the suite of tools Cloudflare offered expanded as well. Luckily, one page rule could perform multiple actions and set various settings at the same time.

Especially, using wildcards and variables for redirects/rewrites and the forwarding actions allowed for some powerful changes to URLs. Similar to regex with a different syntax, users could match in multiple parts of the URL, (sub-)domain, path and query strings, with wildcards * and fixed text.
It allowed for some impressive acrobatics, not implemented as easily or as performant than with other tools. It lacked the flexibility of regex, but was nevertheless powerful.

It is the ‘If This Then That’ of Cloudflare. Where the ‘If…’ is a URL, and the ‘Then That’ is changing how we handle traffic to specific parts of a ‘zone’. But it's not without its limitations.

Limitations

Getting to the downsides of Page Rules, there are a few. The limited matching of URLs in the absence of regex, the limited amount of rules in the free plans and most importantly for Cloudflare, the difficulty of scaling them in their infrastructure.

After the announcement of their plan to work on replacing Page Rules with a more modern approach about 2 years ago, Cloudflare introduced more and more other types of rules:

Even though these new types of rules have been around for a bit, Page Rules were still around and possible to use. Some settings were only available in Page Rules for some time.

Order of execution

Part of the official announcement was the explanation of the previous and future order of execution, which deviates a little from the previous paradigm.
When Page Rules contained all possible actions, they are now spread over multiple steps:

Migration to the modern Rules feature

Cloudflare has now started to show a deprecation warning in the dashboard, letting users know about it and the upcoming milestones and availability.

Page Rules are deprecated. You should consider alternative Rules options due to their enhanced configurability. Refer to the migration guide for details.

The relevant dates are as follows:

  • 2024-07-01 – Page Rules no longer available for new Cloudflare accounts and zones on a Free plan.

  • 2024-08-01 – Page Rules no longer available for new Cloudflare accounts and zones on a Pro or Business plan.

  • 2024-10-01 – Page Rules no longer available for new Cloudflare accounts and zones on an Enterprise plan.

  • 2025-01-06 – For existing accounts and zones on any plan, you can no longer create new Page Rules (maintenance mode).

  • 2025 (all year) – Migration of existing Page Rules to modern Rules features. You cannot edit any existing Page Rules eligible for migration during this migration period.

Cloudflare provides an extensive migration documentation, outlining how to implement each functionality of Page Rules differently.
If the examples given there are not sufficient, their documentation of the new rules provide more context and examples.

New limits with the modern Rules feature

While Page Rules allowed for wildcard matching in any place of the URL, like in the middle of the path, new Redirect Rules are more limited.
Especially for sites on the free plan.

While the operators of the new Redirect Rule like starts with and does not equal, offer some new easy to understand and use options, complex matching and wildcards need to use the new matches regex operator.

Some usages and examples are lined out in the docs, also showing on how to use the dynamic destination options, like regex_replace() :

However, when trying to use that approach, there was a quick error message, mentioning the restriction of some functions to paid plans:

regex_replace()is not allowed for target url because not entitled: the use of function regex replace is not allowed, a Business plan or a WAF Advanced plan is required

Conclusion

Cloudflare is giving users a generous timeframe to adjust to the changes, plan and perform their migration and decide if they want to upgrade to a paid plan for extra features.

Configuring rules with wildcard matching got a lot harder, for users not familiar with the ruleset engine syntax and regex. So some of that "if this than that" and "the user-friendly UI for htaccess" magic might get lost.

0
Subscribe to my newsletter

Read articles from Joda Stößer directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Joda Stößer
Joda Stößer

Motivated by weird problems & sleek solutions. Working on, learning with and bootstrapping coders.fail #BuildInPublic Passionate about tech and helping people as well as combining the two.