You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { Render, TabItem, Tabs, Example } from"~/components";
9
9
10
-
Cloudflare recommends that you consider using modern Rules features for your new implementations instead of Page Rules. Follow the recommendations in this migration guide to learn about the [new Rules products](/rules/)and how you can start adopting them today.
10
+
Cloudflare is continuously improving its platform to deliver more powerful and scalable tools for managing your configurations. To help you take full advantage of these improvements, we recommend using [modern Rules features](/rules/)for new implementations. These products are designed to overcome limitations of Page Rules while offering greater flexibility, scalability, and ease of use.
11
11
12
12
## Page Rules migration
13
13
14
-
Cloudflare plans to migrate your existing Page Rules during 2025. You do not need to migrate your own rules, as Cloudflare will handle this process for you. However, it is beneficial to understand the correspondence between the different Page Rules settings and new Rules features ahead of the migration. This will help you familiarize yourself with implementing the new types of rules in your Cloudflare account.
14
+
To make the transition seamless, Cloudflare will handle the migration of your existing Page Rules automatically. This process is planned for **late 2025 or beyond**, with no action required on your part. You will receive advance notification before any changes are made.
15
15
16
-
We encourage you to explore and start using the new Rules products to take advantage of their enhanced capabilities and features. This migration guide will be updated in the coming months with additional information about the Page Rules migration. Some instructions may also change as we simplify configuration deployment and release new features as part of this project. Cloudflare users will receive email updates about the migration of the Page Rules configured on their Cloudflare account before the migration occurs. We will not perform any migration or changes on your behalf without prior notification.
16
+
If you wish to explore the benefits of modern Rules features sooner, you can begin adopting them today. Doing so allows you to:
17
17
18
-
## Context
18
+
- Take advantage of modern features and capabilities sooner.
19
+
- Customise and refine your rules to match your evolving needs.
20
+
21
+
To assist with this process, we've provided a comprehensive mapping between Page Rules settings and modern Rules products in this guide.
22
+
23
+
## Why transition?
19
24
20
25
Cloudflare Page Rules has several fundamental limitations, such as triggering solely based on URL patterns and being limited to 125 rules per zone for performance reasons. These rules are also complex to debug when multiple page rules apply to the same incoming request.
21
26
@@ -28,64 +33,39 @@ Improvements in modern Rules features include:
28
33
-**Easier troubleshooting**: Rule execution is more predictable, since each rule operates independently, simplifying troubleshooting. Additionally, [Cloudflare Trace](/fundamentals/basic-tasks/trace-request/) helps understand rule interactions.
29
34
-**Improved consistency**: New Rules features also ensure consistency, with common fields and capabilities shared across products, offering a seamless experience and predictable Terraform configurations.
30
35
31
-
## Important differences
36
+
## Key differences
32
37
33
38
The evaluation and execution order of Rules features is different from Page Rules:
34
39
35
-
- Requests handled by Workers will suppress Page Rules actions, but they will not suppress actions from modern Rules features.
36
-
- The first Page Rule to match is applied (also called first match). In contrast, other rules like Cache Rules are stackable. This means that multiple matching rules can be combined and applied to the same request (last match). For example, if multiple cache rules match the same URL, then the features set in those cache rules will all be applied in order. For more information, refer to [Order and priority](/cache/how-to/cache-rules/order/) in the Cache documentation and the [Origin Rules FAQ](/rules/origin-rules/faq/#what-happens-if-more-than-one-origin-rule-matches-the-current-request).
37
-
- A Page Rule may include multiple configurations for different products that are applied in a sequence selected by the customer. In contrast, modern Rules features are evaluated [in a fixed sequence](/rules/origin-rules/#execution-order), with a customer being able to define the rule order within a product [phase](/ruleset-engine/reference/phases-list/). Refer to the [Ruleset Engine documentation](/ruleset-engine/about/) for more information.
38
-
- Modern Rules features will take precedence over Page Rules. For example, if you have Page Rules and Cache Rules defining caching settings for the same path, Cache Rules will take precedence.
39
-
40
-
### Behavior change in Cache Rules
41
-
42
-
There is a behavior change between Page Rules and Cache Rules: when you select **Eligible for cache** in a cache rule, the Cache Everything feature is now enabled by default.
43
-
44
-
If you need to keep the exact same behavior you had with Page Rules, you will need to make some additional configurations. For details, refer to [Migration from Page Rules](/cache/how-to/cache-rules/page-rules-migration/) in the Cache documentation.
40
+
-**Rule matching logic**: Page Rules apply the first matching rule *(first match wins)*. In contrast, modern Rules are stackable, meaning **multiple matching rules** can combine and apply to the same request *(last match wins)*. For example, if multiple Cache Rules match the same URL, the features in those rules will all apply in order.
41
+
-**Action separation**: A Page Rule may include multiple actions for different products that are applied in a **sequence** selected by the customer within the Page Rule itself. Modern Rules features are evaluated [in a fixed sequence](/rules/origin-rules/#execution-order), with customers defining the rule order within a product [phase](/ruleset-engine/reference/phases-list/).
42
+
-**Precedence**: Modern Rules features **take precedence** over Page Rules. For instance, if both define caching settings for the same path, Cache Rules will override Page Rules.
43
+
-**Caching behaviour**: In Cache Rules, selecting *Eligible for cache* automatically enables *Cache Everything* by default. To maintain the exact behaviour of Page Rules, you may need to [adjust your configuration](/cache/how-to/cache-rules/page-rules-migration/).
44
+
-**Interactions with Workers**: Requests handled by Workers will suppress Page Rules actions, but they **will not suppress** actions from modern Rules features.
45
45
46
46
## Convert Page Rules URLs to filter expressions
47
47
48
-
When migrating a Page Rule you will need to write a filter expression equivalent to your Page Rules URL using the Rules language.
49
-
50
-
Rule filter expressions are built differently from Page Rules URLs. You can use different elements of the Rules language in a filter expression, including [fields](/ruleset-engine/rules-language/fields/), [functions](/ruleset-engine/rules-language/functions/), and [operators](/ruleset-engine/rules-language/operators/).
51
-
52
-
You will need to adapt your Page Rules URLs when migrating them to modern rules. In the Rules language, use the `wildcard` and `strict wildcard` operators (case insensitive and case sensitive operator, respectively) for [wildcard matching](/ruleset-engine/rules-language/operators/#wildcard-matching). Enterprise and Business customers can use regular expressions, but it will also require adapting the original URLs in your Page Rules to regular expressions.
53
-
54
-
### Matching full URIs with wildcards
55
-
56
-
The Page Rules URL matching does not take into account the URI scheme (for example, `https://`) and the query string of incoming requests, unless included in the rule URL. However, the `http.request.full_uri` field used in filter expressions includes the URI scheme and the query string (when the incoming request includes one). When writing a filter expression equivalent to a Page Rule URL, you may want to perform wildcard matching on the full URI. To check for a match regardless of the URI scheme and query string, you can add a `*` wildcard at the beginning and at the end of the literal string with wildcards.
57
-
58
-
For example, if you were using the Page Rules URL `example.com/*/downloads/*.txt`, in modern Rules features you could use an expression such as `http.request.full_uri wildcard *example.com/*/downloads/*.txt*` to make sure it matches any scheme and any query string.
48
+
Modern Rules use filter expressions instead of URL patterns. These expressions, built with the Rules language, allow greater precision by leveraging [fields](/ruleset-engine/rules-language/fields/), [functions](/ruleset-engine/rules-language/functions/), and [operators](/ruleset-engine/rules-language/operators/).
59
49
60
-
Alternatively, you could match on individual hostname and URI path fields instead of the full URI field. For example, `http.host eq "example.com" and http.request.uri.path wildcard "/*/downloads/*.txt"`. This was the conversion method followed in the table with example conversions from Page Rules URLs to filter expressions.
50
+
The following example demonstrates the use of the `http.request.full_uri`[field](/ruleset-engine/rules-language/fields/standard-fields/#httprequestfull_uri) and the `wildcard` operator for [wildcard matching](/ruleset-engine/rules-language/operators/#wildcard-matching):
61
51
62
-
### Example conversions from Page Rules URLs to filter expressions
52
+
<Example>
53
+
A **Page Rules URL** like
63
54
64
-
The following table lists the most common Page Rule URLs and their equivalent filters:
55
+
`example.com/*/downloads/*.txt`
65
56
66
-
<table-wrapstyle="font-size: 87%">
57
+
becomes a **filter expression** such as:
67
58
68
-
| Target and components | <divstyle="width:130px">Page Rule URL example</div> | Filter expression using Rules language |
| Index page of root domain only<br/>_(Domain + Path)_|`example.com/`|`http.host eq "example.com" and http.request.uri.path eq "/"`|
71
-
| Everything on a specific domain<br/>_(Domain)_|`example.com/*`|`http.host eq "example.com"`|
72
-
| All subdomains and URLs on a specific domain<br/>_(Domain)_|`*example.com/*`|`http.host contains "example.com"`|
73
-
| Only subdomains and their URLs<br/>_(Domain)_|`*.example.com/*`|`http.host contains ".example.com"`|
74
-
| Specific file on subdomains of a specific domain<br/>_(Domain + Path)_|`*.example.com/*wp-login.php`|`ends_with(http.host, ".example.com") and ends_with(http.request.uri.path, "wp-login.php")`|
75
-
| Specific file extension in a directory or its subdirectories of a domain<br/>_(Domain + Path)_|`example.com/archives/*.zip`|`http.host eq "example.com" and starts_with(http.request.uri.path, "/archives/") and http.request.uri.path.extension eq "zip"`|
76
-
| Specific file extension in any subdirectory of a domain<br/>_(Domain + Path)_|`example.com/*/downloads/*.txt`|`http.host eq "example.com" and not starts_with(http.request.uri.path, "/downloads/") and http.request.uri.path contains "/downloads/" and http.request.uri.path.extension eq "txt"`|
77
-
| Specific directory and all its contents on all subdomains of a specific subdomain<br/>_(Domain + Path)_|`*cdn.example.com/file/*`|`http.request.full_uri contains "cdn.example.com/file/"`|
78
-
| Specific URL on all domains<br/>_(Path)_|`*/images`<br/>(required [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/)) |`http.request.uri.path eq "/images"`|
79
-
| Specific directory and its subdirectories on all domains<br/>_(Path)_|`*/images/*`<br/>(required [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/)) |`starts_with(http.request.uri.path, "/images/")`|
80
-
| Specific file in any directory<br/>_(Path)_|`*/wp-login.php`<br/>(required [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/)) |`ends_with(http.request.uri.path, "/wp-login.php")`|
81
-
| Specific query string on all domains<br/>_(Path)_|`*/*?country=GB`<br/>(required [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/)) |`http.request.uri.query eq "country=GB"`|
82
-
| Part of a query string on all domains<br/>_(Path)_|`*/*?*country=GB*`<br/>(required [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/)) |`http.request.uri.query contains "country=GB"`|
-**Protocol scheme**: Page Rules URL matching does not include the URI scheme (for example, `http://` or `https://`) unless explicitly included in the rule. Filter expressions using `http.request.full_uri` field, however, require matching the full URI, including the protocol scheme. To make your filter expression scheme-agnostic, use `http*://` as a wildcard for both `http://` and `https://`.
64
+
-**Query strings**: Page Rules ignore query strings unless they are part of the rule URL. Filter expressions include the query string automatically, as part of the `http.request.full_uri` field. To ensure query strings do not affect your matching, append a `*` wildcard at the end of your filter expression, such as `.txt*`.
85
65
86
66
## Feature correspondence table
87
67
88
-
The following table summarizes how different Page Rules settings will be migrated to other Rules features. You can refer to this table and the next sections to learn more about the new way of implementing a given Page Rules setting, and also to learn how you can manually migrate your existing Page Rules.
68
+
To help you map existing Page Rules to modern Rules products, this table outlines how Page Rules settings translate to modern Rules and provides examples for common configurations.
0 commit comments