Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

Page Rules 移行ガイド

最終更新 Markdown で表示Agent セットアップ

Cloudflare は、設定管理向けにより強力でスケーラブルなツールを提供できるよう、プラットフォームを継続的に改善しています。これらの改善を活かすため、新規の実装では 現行の Rules 機能 を使うことをおすすめします。これらの製品は Page Rules の制約を解消し、柔軟性、スケーラビリティ、使いやすさを高めます。

まず始めるには、Cloudflare ダッシュボードの Rules > Overview にあるワンクリックテンプレートを見てください。リダイレクト、リライト、ヘッダー変更などのよくある設定を簡単にでき、セットアップが速くなります。

Page Rules の移行

移行をスムーズにするため、既存の Page Rules の移行は Cloudflare が自動で行います。この処理は 2025 年後半以降を予定しており、利用者側の操作は不要です。変更の前には事前通知があります。

現行の Rules 機能の利点を先に使いたい場合は、今すぐ導入を始められます。早めに導入すると、次ができます。

  • 現行機能をより早く使える。
  • 変化する要件に合わせてルールを調整できる。

このガイドでは、この作業を助けるため、Page Rules の設定と現行の Rules 製品の対応関係を示します。

移行する理由

Cloudflare Page Rules には根本的な制約があります。URL パターンだけで発火すること、パフォーマンス上の理由でゾーンあたり 125 ルールまでであること、などです。同じ受信リクエストに複数の Page Rule が当たると、デバッグも複雑です。

2022 年、ブログ投稿 The future of Page Rules で、Page Rules を専用製品群に置き換えると発表しました。各製品は用途に特化し、利用者により多くの制御を渡します。新しい Rules 製品 — Configuration RulesCompression RulesOrigin RulesRedirectsTransform Rules — は一般提供(GA)済みで、すでに数万の Cloudflare 顧客が使っています。

現行の Rules 機能の改善点は次のとおりです。

  • 新しいエンジン: 新しい Rules 機能は Ruleset Engine で動きます。多くの HTTP リクエスト / レスポンスフィールドを扱う堅牢な言語で、柔軟に設定できます。
  • スケーラビリティの向上: スケーラビリティが上がったため、Cloudflare プランのクォータも増えています。
  • トラブルシューティングの容易さ: 各ルールが独立して動くため、実行結果を予測しやすく、切り分けが簡単です。さらに Cloudflare Trace で、ルール同士の相互作用を確認できます。
  • 一貫性の向上: 現行の Rules 機能は、製品間で共通のフィールドと機能を持ち、操作感と Terraform 設定の予測しやすさが揃っています。

主な違い

Rules 機能の評価と実行順序は、Page Rules と異なります。

  • ルールの一致ロジック: Page Rules は、最初に一致したルールだけを適用します(先勝ち)。現行の Rules は積み重ね可能で、複数の一致ルールを組み合わせて同じリクエストに適用できます(後勝ち)。たとえば同じ URL に複数の Cache Rules が一致すると、それらの機能が順にすべて適用されます。
  • アクションの分離: Page Rule には、複数製品向けの複数アクションを含め、Page Rule 内で利用者が選んだ順に適用できます。現行の Rules 機能は 固定の順 で評価され、利用者は製品の フェーズ 内でのルール順を定義します。
  • 優先度: 現行の Rules 機能は Page Rules より優先されます。たとえば同じパスのキャッシュ設定を両方で定義した場合、Cache Rules が Page Rules を上書きします。
  • キャッシュの動作: Cache Rules で Eligible for cache を選ぶと、デフォルトで Cache Everything が有効になります。Page Rules とまったく同じ動作にするには、設定の調整 が必要になることがあります。
  • Workers との相互作用: Workers が処理したリクエストは Page Rules のアクションを抑制しますが、現行の Rules 機能のアクションは抑制しません。

Page Rules の URL をフィルター式へ変換する

現行の Rules は、URL パターンではなくフィルター式を使います。Rules 言語で作るこれらの式は、フィールド関数演算子 を使い、より精密に一致させられます。

次の例は、http.request.full_uri フィールドと、ワイルドカード一致 用の wildcard 演算子の使い方です。

Page Rules の URL の例:

example.com/*/downloads/*.txt

これは、次のような フィルター式 になります。

http.request.full_uri wildcard "http*://example.com/*/downloads/*.txt*"

Single RedirectsURL Rewrite Rules には、Wildcard pattern という簡易ビューもあります。完全なフィルター式(http.request.full_uri wildcard "http*://example.com/*/downloads/*.txt*")を書かずに、URL パターン(http*://example.com/*/downloads/*.txt*)だけを指定できます。

注意点

  • プロトコルスキーム: Page Rules の URL 一致は、ルールに明示しない限り URI スキーム(http://https:// など)を含みません。一方、http.request.full_uri フィールドを使うフィルター式は、プロトコルスキームを含む完全な URI の一致が必要です。スキームを問わないフィルター式にするには、http://https:// の両方に合うワイルドカードとして http*:// を使います。
  • クエリ文字列: Page Rules は、ルール URL の一部でない限りクエリ文字列を無視します。フィルター式は、http.request.full_uri フィールドの一部としてクエリ文字列を自動で含みます。クエリ文字列が一致に影響しないようにするには、フィルター式の末尾に * ワイルドカードを付けます(.txt* など)。

機能対応表

既存の Page Rules を現行の Rules 製品へ対応づけるため、この表は Page Rules の設定が現行の Rules にどう移るかと、よくある設定の例を示します。

また、よくある設定を速くできるように、Cloudflare ダッシュボードの Rules > Overview には、ワンクリックテンプレートが多数あります。リダイレクト、リライト、ヘッダー変更など、よく使う機能を、あらかじめ入ったフィルター式とアクションですぐにデプロイできます。セットアップを速くするため、ダッシュボードでこれらのテンプレートを確認してください。

Page Rules の設定 新しい実装で使うもの 移行 / 置き換えの手順
Always Use HTTPS Redirect Rules (Single Redirects) Always Use HTTPS を移行する
Browser Cache TTL Cache Rules Browser Cache TTL を移行する
Browser Integrity Check Configuration Rules Browser Integrity Check を移行する
Bypass Cache on Cookie Cache Rules Bypass Cache on Cookie を移行する
Cache By Device Type Cache Rules Cache By Device Type を移行する
Cache Deception Armor Cache Rules Cache Deception Armor を移行する
Cache Level Cache Rules Cache Level を移行する
Cache on Cookie Cache Rules Cache on Cookie を移行する
Cache TTL by status code Cache Rules Cache TTL by status code を移行する
Custom Cache Key Cache Rules Custom Cache Key を移行する
Disable Apps Configuration Rules Disable Apps を移行する
Disable Performance なし(非推奨) Disable Performance を置き換える
Disable Railgun なし(非推奨) なし
Disable Security なし(非推奨) Disable Security を置き換える
Disable Zaraz Configuration Rules Disable Zaraz を移行する
Edge Cache TTL Cache Rules Edge Cache TTL を移行する
Email Obfuscation Configuration Rules Email Obfuscation を移行する
Forwarding URL Redirect Rules (Single Redirects) Forwarding URL を移行する
Host Header Override Origin Rules Host Header Override を移行する
IP Geolocation Header Transform Rules (Managed Transforms) IP Geolocation Header を移行する
Opportunistic Encryption Configuration Rules Opportunistic Encryption を移行する
Origin Cache Control Cache Rules Origin Cache Control を移行する
Origin Error Page Pass-thru Cache Rules Origin Error Page Pass-thru を移行する
Polish Configuration Rules Polish を移行する
Query String Sort Cache Rules Query String Sort を移行する
Resolve Override Origin Rules Resolve Override を移行する
Respect Strong ETags Cache Rules Respect Strong ETags を移行する
Response Buffering なし(非推奨) なし
Rocket Loader Configuration Rules Rocket Loader を移行する
Security Level Configuration Rules Security Level を移行する
True Client IP Header Transform Rules (Managed Transforms) True Client IP Header を移行する
SSL Configuration Rules SSL を移行する
Web Application Firewall なし(非推奨) なし

Always Use HTTPS を移行する

前提:

example.com の全サブドメインと example.com 自身について、HTTP から HTTPS へ自動リダイレクトする Page Rule を設定しています。

  • URL *example.com/*
  • Setting: Always Use HTTPS

移行方法:

  1. HTTP リクエストを常に HTTPS へリダイレクトする Single Redirect を作成 します。Redirect from HTTP to HTTPS ルールテンプレートを選ぶか、次のルール設定を入力します。

    • If incoming requests match: Wildcard pattern
      • Request URL: http://*
    • Then:
      • Target URL: https://${1}
      • Status code: 301
      • Preserve query string: 有効
  2. 既存の Page Rule をオフにし、作成したリダイレクトの動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Single Redirect へ移行
「Always Use HTTPS」設定の Page Rule の例 例の Page Rule の「Always Use HTTPS」設定に相当する Single Redirect

Automatic HTTPS Rewrites を移行する

前提:

example.com の全サブドメインと example.com 自身について、Automatic HTTPS Rewrites をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Automatic HTTPS Rewrites
  • Value: On

移行方法:

  1. example.com を含む任意のホスト名について、HTTP リンクを常に HTTPS へ書き換える Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Automatic HTTPS Rewrites
      • Value: On
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Automatic HTTPS Rewrites」設定の Page Rule の例 例の Page Rule の「Automatic HTTPS Rewrites」設定に相当する Configuration Rule

Browser Cache TTL を移行する

前提:

example.com の全サブドメインと example.com 自身について、ブラウザキャッシュ TTL を 1 日にする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Browser Cache TTL
  • Enter Browser Cache TTL: a day

移行方法:

  1. example.com を含む任意のホスト名について、ブラウザでのキャッシュ TTL を 1 日にする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Browser TTL: Override origin and use this TTL
      • Input time-to-live (TTL): 1 day
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Browser Cache TTL」設定の Page Rule の例 例の Page Rule の「Browser Cache TTL」設定に相当する Cache Rule

Browser Integrity Check を移行する

前提:

example.com の全サブドメインと example.com 自身について、Browser Integrity Check をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Browser Integrity Check
  • Value: On

移行方法:

  1. example.com を含む任意のホスト名について、ボットと脅威から守るため Browser Integrity Check をオンにする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Browser Integrity Check
      • Value: On
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Browser Integrity Check」設定の Page Rule の例 例の Page Rule の「Browser Integrity Check」設定に相当する Configuration Rule

前提:

example.com の全サブドメインと example.com 自身について、Bypass Cache on Cookie をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Bypass Cache on Cookie
  • Enter value: test_cookie

移行方法:

  1. example.com を含む任意のホスト名について、Cookie test_cookie を含むリクエストのキャッシュをバイパスする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com" AND Cookie contains "test-cookie"
      • Expression Editor を使う場合:
        (http.host contains "example.com" and http.cookie contains "test-cookie")
    • Then:
      • Cache eligibility: Bypass cache
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Bypass Cache on Cookie」設定の Page Rule の例 例の Page Rule の「Bypass Cache on Cookie」設定に相当する Cache Rule

Cache By Device Type を移行する

前提:

example.com の全サブドメインと example.com 自身について、Cache By Device Type をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Cache By Device Type
  • Value: On

移行方法:

  1. example.com を含む任意のホスト名について、ユーザーエージェントまたはデバイスタイプに基づいてコンテンツをキャッシュする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Cache key
        • Cache by device type: On
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Cache By Device Type」設定の Page Rule の例 例の Page Rule の「Cache By Device Type」設定に相当する Cache Rule

Cache Deception Armor を移行する

前提:

example.com の全サブドメインと example.com 自身について、Cache Deception Armor をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Cache Deception Armor

移行方法:

  1. example.com を含む任意のホスト名について、キャッシュデセプション攻撃から守る Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Cache key
        • Cache deception armor: On
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Cache Deception Armor」設定の Page Rule の例 例の Page Rule の「Cache Deception Armor」設定に相当する Cache Rule

Cache Level(Cache Everything)を移行する

前提:

example.com の全サブドメインと example.com 自身について、すべてのアセットをキャッシュする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Cache Level
  • Select Cache Level: Cache Everything

移行方法:

  1. example.com を含む任意のホスト名について、キャッシュレベルを調整する Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Cache Level」を「Cache Everything」にした Page Rule の例 例の Page Rule の「Cache Level: Cache Everything」設定に相当する Cache Rule

前提:

example.com の全サブドメインと example.com 自身について、Cookie test-cookie を含むレスポンスをキャッシュする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Cache on Cookie
  • Enter value: test-cookie

移行方法:

  1. example.com を含む任意のホスト名について、Cookie test_cookie を含むレスポンスをキャッシュする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com" AND Cookie contains "test-cookie"
      • Expression Editor を使う場合:
        (http.host contains "example.com" and http.cookie contains "test-cookie")
    • Then:
      • Cache eligibility: Eligible for cache
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Cache on Cookie」設定の Page Rule の例 例の Page Rule の「Cache on Cookie」設定に相当する Cache Rule

Cache TTL by status code を移行する

前提:

example.com の全サブドメインと example.com 自身について、ステータスコード 200 から 599 のレスポンスを 1 日間キャッシュする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Cache TTL by status code
  • Status code or enter range: 200-599
  • Select option: a day

移行方法:

  1. example.com を含む任意のホスト名について、ステータスコード 200 から 599 のレスポンスを 1 日間キャッシュする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
      • Then:
        • Cache eligibility: Eligible for cache
        • Setting: Edge TTL
          • Use cache-control header if present, use default Cloudflare caching behavior if not
          • Status code TTL:
            • Scope: Range
            • From: 200
            • To: 599
            • Duration: 1 day
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Cache TTL by status code」設定の Page Rule の例 例の Page Rule の「Cache TTL by status code」設定に相当する Cache Rule

Custom Cache Key を移行する

前提:

example.com の全サブドメインと example.com 自身について、すべてのクエリ文字列パラメーターを対象とするカスタムキャッシュキーを設定する Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Custom Cache Key
    • Query String: All query string parameters

移行方法:

  1. example.com を含む任意のホスト名について、すべてのクエリ文字列パラメーターを対象とするカスタムキャッシュキーを設定する Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Cache key
        • Query string: All query string parameters
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Custom Cache Key」設定の Page Rule の例 例の Page Rule の「Custom Cache Key」設定に相当する Cache Rule

Disable Apps を移行する

前提:

example.com の全サブドメインと example.com 自身について、Cloudflare Apps(非推奨)をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Disable Apps

移行方法:

  1. example.com を含む任意のホスト名について、Cloudflare Apps(非推奨)を無効にする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Disable Apps
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Disable Apps」設定の Page Rule の例 例の Page Rule の「Disable Apps」設定に相当する Configuration Rule

Disable Performance を置き換える

この Page Rules 設定は Polish と Rocket Loader をオフにしていました。関連する Cloudflare 機能は、Configuration Rules で個別にオン / オフできます。

前提:

example.com の全サブドメインと example.com 自身について、Disable Performance(非推奨)の Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Disable Performance

置き換え方法:

  1. example.com を含む任意のホスト名について、Polish と Rocket Loader を無効にする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Polish: Off
      • Rocket Loader: Off
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Disable Performance」設定の Page Rule の例 例の Page Rule の「Disable Performance」設定に部分的に相当する Configuration Rule

Disable Security を置き換える

この Page Rules 設定は、Email Obfuscation、Rate Limiting(旧バージョン)、Scrape Shield、URL (Zone) Lockdown、WAF マネージドルール(旧バージョン)をオフにします。関連する Cloudflare 機能は、Configuration Rules と WAF カスタムルールで個別にオン / オフできます。

前提:

example.com の全サブドメインと example.com 自身について、Disable Security(非推奨)の Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Disable Security

この設定は、次の Cloudflare セキュリティ機能の一部をオフにしていました。Email Obfuscation、Rate Limiting(旧バージョン)、Scrape Shield、URL (Zone) Lockdown、WAF マネージドルール(旧バージョン)です。

置き換え方法:

  1. 1 つ以上のセキュリティ機能をオフにする Configuration Rule を作成 します。

  2. 必要なら、許可リスト内の IP アドレスからのリクエストについて、WAF マネージドルールセットの 1 つ以上のルールをスキップする WAF 例外を作成 します。

  3. 既存の Page Rule をオフにし、作成したルールの動作を確認します。

  4. テストが成功したら、既存の Page Rule を削除します。

Disable Zaraz を移行する

前提:

example.com の全サブドメインと example.com 自身について、Zaraz をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Disable Zaraz

移行方法:

  1. example.com を含む任意のホスト名について、Zaraz をオフにする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Disable Zaraz
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Disable Zaraz」設定の Page Rule の例 例の Page Rule の「Disable Zaraz」設定に相当する Configuration Rule

Edge Cache TTL を移行する

前提:

example.com の全サブドメインと example.com 自身について、Edge Cache TTL を調整する Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Edge Cache TTL
  • Enter Edge Cache TTL: a day

移行方法:

  1. example.com を含む任意のホスト名について、Cloudflare エッジでのキャッシュ TTL を 1 日にする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Edge TTL
        • Ignore cache-control header and use this TTL
        • Input time-to-live (TTL): 1 day
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Edge Cache TTL」設定の Page Rule の例 例の Page Rule の「Edge Cache TTL」設定に相当する Cache Rule

Email Obfuscation を移行する

前提:

example.com の全サブドメインと example.com 自身について、Email Obfuscation をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Email Obfuscation
  • Value: Off

移行方法:

  1. example.com を含む任意のホスト名について、Email Obfuscation をオフにする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Email Obfuscation
        • Value: Off
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Email Obfuscation」設定の Page Rule の例 例の Page Rule の「Email Obfuscation > Off」設定に相当する Configuration Rule

Forwarding URL を移行する

例 1: www をルートドメインへリダイレクトする

前提:

すべての URI パスで www.example.comexample.com へ恒久リダイレクトする Page Rule を設定しています。

  • URL: www.example.com/*
  • Setting: Forwarding URL
  • Select Status code: 301 - Permanent Redirect
  • Destination URL: https://example.com/$1

移行方法:

  1. https://www.example.com へのリクエストを https://example.com へ恒久リダイレクトする Single Redirect を作成 します。Redirect from WWW to Root ルールテンプレートを選ぶか、次のルール設定を入力します。

    • If incoming requests match: Wildcard pattern
      • Request URL: https://www.example.com/*
    • Then:
      • Target URL: https://example.com/${1}
      • Status code: 301
      • Preserve query string: 有効
  2. 既存の Page Rule をオフにし、作成したリダイレクトの動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

ルールの同等性に関する注意

同じ例にある従来の Page Rule と、Single Redirects を使った例は完全には一致しません。

完全に同等にするには、HTTP と HTTPS の両方の受信リクエストに一致させる必要があります。次のようなワイルドカードパターンで実現できます(http のあとに追加の * がある点に注意してください)。

  • Request URL: http*://www.example.com/*

あわせて Target URL も、1 番目ではなく 2 番目のワイルドカードキャプチャグループを使うように変更する必要があります(上記パターンの 2 番目の * がキャプチャしたテキストに対応します)。

  • Target URL: https://example.com/${2}
Page Rules の設定 Single Redirect へ移行
「Forwarding URL」設定の Page Rule の例 1 例の Page Rule 1 の「Forwarding URL」設定に相当する Single Redirect

例 2: 旧パス配下の全ページを新パスへリダイレクトする

前提:

example.com/old-pathexample.com/new-path へ恒久リダイレクトする Page Rule を設定しています。

  • URL: example.com/old-path/*
  • Setting: Forwarding URL
  • Select Status code: 301 - Permanent Redirect
  • Destination URL: https://example.com/new-path/$1

移行方法:

  1. example.com/old-path へのリクエストを example.com/new-path へ恒久リダイレクトする Single Redirect を作成 します。

    • If incoming requests match: Wildcard pattern
      • Request URL: https://example.com/old-path/*
    • Then:
      • Target URL: https://example.com/new-path/${1}
      • Status code: 301
      • Preserve query string: 有効
  2. 既存の Page Rule をオフにし、作成したリダイレクトの動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

ルールの同等性に関する注意

同じ例にある従来の Page Rule と、Single Redirects を使った例は完全には一致しません。

完全に同等にするには、HTTP と HTTPS の両方の受信リクエストに一致させる必要があります。次のようなワイルドカードパターンで実現できます(http のあとに追加の * がある点に注意してください)。

  • Request URL: http*://example.com/old-path/*

あわせて Target URL も、1 番目ではなく 2 番目のワイルドカードキャプチャグループを使うように変更する必要があります(上記パターンの 2 番目の * がキャプチャしたテキストに対応します)。

  • Target URL: https://example.com/new-path/${2}
Page Rules の設定 Single Redirect へ移行
「Forwarding URL」設定の Page Rule の例 2 例の Page Rule 2 の「Forwarding URL」設定に相当する Single Redirect

Host Header Override を移行する

前提:

example.com の任意のサブドメインと example.com 自身宛ての全リクエストについて、Host HTTP ヘッダーを example.saas-provider.com に変える Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Host Header Override
  • Enter value: example.saas-provider.com

移行方法:

  1. example.com を含む任意のホスト名について、Host ヘッダーを example.saas-provider.com に変える Origin Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Set origin parameters:
        • Host Header > Rewrite to: example.saas-provider.com
  2. 既存の Page Rule をオフにし、作成した Origin Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Origin Rule へ移行
「Host Header Override」設定の Page Rule の例 例の Page Rule の「Host Header Override」設定に相当する Origin Rule

IP Geolocation Header を移行する

前提:

example.com の任意のサブドメインと example.com 自身宛ての全リクエストについて、CF-IPCountry HTTP ヘッダーを追加する Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: IP Geolocation Header
  • Value: On

移行方法:

  1. すべてのリクエストに CF-IPCountry とその他の位置情報ヘッダーを追加するため、Transform Rules 機能である Add visitor location headers Managed Transform をオン にします。
  2. 既存の Page Rule をオフにし、Managed Transform の動作を確認します。
  3. テストが成功したら、既存の Page Rule を削除します。
Page Rules の設定 Managed Transform へ移行
「IP Geolocation Header」設定の Page Rule の例 例の Page Rule の「IP Geolocation Header」設定に相当する「Add visitor location headers」Managed Transform

Opportunistic Encryption を移行する

前提:

example.com の全サブドメインと example.com 自身について、Opportunistic Encryption をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Opportunistic Encryption
  • Value: Off

移行方法:

  1. example.com を含む任意のホスト名について、Opportunistic Encryption をオフにする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Opportunistic Encryption
        • Value: Off
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Opportunistic Encryption」設定の Page Rule の例 例の Page Rule の「Opportunistic Encryption > Off」設定に相当する Configuration Rule

Origin Cache Control を移行する

前提:

example.com の全サブドメインと example.com 自身について、Origin Cache Control をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Origin Cache Control
  • Value: Off

移行方法:

  1. example.com を含む任意のホスト名について、エッジキャッシュの動作を決める Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Origin Cache Control
        • Enable Origin Cache Control: Off
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Origin Cache Control」設定の Page Rule の例 例の Page Rule の「Origin Cache Control」設定に相当する Cache Rule

Origin Error Page Pass-thru を移行する

前提:

example.com の全サブドメインと example.com 自身について、Origin Error Page Pass-thru をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Origin Error Page Pass-thru
  • Value: On

移行方法:

  1. example.com を含む任意のホスト名について、エッジキャッシュの動作を決める Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Origin error page pass-thru
        • Use Origin error page pass-thru: On
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Origin Error Page Pass-thru」設定の Page Rule の例 例の Page Rule の「Origin Error Page Pass-thru > On」設定に相当する Cache Rule

Polish を移行する

前提:

example.com の全サブドメインと example.com 自身について、Polish をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Polish
  • Value: Off

移行方法:

  1. example.com を含む任意のホスト名について、Polish をオフにする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Polish
        • Select value: Off
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Polish」設定の Page Rule の例 例の Page Rule の「Polish > Off」設定に相当する Configuration Rule

Query String Sort を移行する

前提:

example.com の全サブドメインと example.com 自身について、Query String Sort をオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Query String Sort
  • Value: On

移行方法:

  1. example.com を含む任意のホスト名について、キャッシュ用にクエリ文字列パラメーターをソートする Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Cache key
        • Sort query string: On
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Query String Sort」設定の Page Rule の例 例の Page Rule の「Query String Sort > On」設定に相当する Cache Rule

Resolve Override を移行する

前提:

example.com の任意のサブドメインと example.com 自身宛ての全リクエストについて、オリジンを example.saas-provider.com に変える Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Resolve Override
  • Enter value: example.saas-provider.com

移行方法:

  1. example.com を含む任意のホスト名について、オリジンを example.saas-provider.com に上書きする Origin Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • DNS Record > Override to: example.saas-provider.com
  2. 既存の Page Rule をオフにし、作成した Origin Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Origin Rule へ移行
「Resolve Override」設定の Page Rule の例 例の Page Rule の「Resolve Override」設定に相当する Origin Rule

Respect Strong ETags を移行する

前提:

example.com の全サブドメインと example.com 自身について、バイト単位の等価チェックをオンにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Respect Strong ETags
  • Value: On

移行方法:

  1. example.com を含む任意のホスト名について、strong ETag を尊重する Cache Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then:
      • Cache eligibility: Eligible for cache
      • Setting: Respect strong ETags
        • Use strong ETag headers: On
  2. 既存の Page Rule をオフにし、作成した Cache Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Cache Rule へ移行
「Respect Strong ETags」設定の Page Rule の例 例の Page Rule の「Respect Strong ETags > On」設定に相当する Cache Rule

Rocket Loader を移行する

前提:

example.com の全サブドメインと example.com 自身について、Rocket Loader をオフにする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Rocket Loader
  • Value: Off

移行方法:

  1. example.com を含む任意のホスト名について、Rocket Loader をオフにする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: Rocket Loader
        • Value: Off
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Rocket Loader」設定の Page Rule の例 例の Page Rule の「Rocket Loader > Off」設定に相当する Configuration Rule

Security Level を移行する

前提:

example.com の全サブドメインと example.com 自身について、Security Level を I'm Under Attack にする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: Security Level
  • Select Security Level: I'm Under Attack

移行方法:

  1. example.com を含む任意のホスト名について、Security Level を I'm Under Attack にする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: I'm Under Attack
      • Value: On
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「Security Level」設定の Page Rule の例 例の Page Rule の「Security Level > I'm Under Attack」設定に相当する Configuration Rule

True Client IP Header を移行する

前提:

example.com の任意のサブドメインと example.com 自身宛ての全リクエストについて、True-Client-IP HTTP ヘッダーを追加する Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: True Client IP Header
  • Value: On

移行方法:

  1. すべてのリクエストに True-Client-IP ヘッダーを追加するため、Transform Rules 機能である Add "True-Client-IP" header Managed Transform をオン にします。
  2. 既存の Page Rule をオフにし、Managed Transform の動作を確認します。
  3. テストが成功したら、既存の Page Rule を削除します。
Page Rules の設定 Managed Transform へ移行
「True Client IP Header」設定の Page Rule の例 例の Page Rule の「True Client IP Header」設定に相当する「Add "True-Client-IP" header」Managed Transform

SSL を移行する

前提:

example.com の全サブドメインと example.com 自身について、SSL を Strict にする Page Rule を設定しています。

  • URL: *example.com/*
  • Setting: SSL
  • Select SSL/TLS encryption mode: Strict

移行方法:

  1. example.com を含む任意のホスト名について、SSL を Strict にする Configuration Rule を作成 します。

    • When incoming requests match: Custom filter expression
      • Expression Builder を使う場合:
        Hostname contains "example.com"
      • Expression Editor を使う場合:
        (http.host contains "example.com")
    • Then the settings are:
      • Setting: SSL
        • Select SSL/TLS encryption mode: Strict
  2. 既存の Page Rule をオフにし、作成した Configuration Rule の動作を確認します。

  3. テストが成功したら、既存の Page Rule を削除します。

Page Rules の設定 Configuration Rule へ移行
「SSL」設定の Page Rule の例 例の Page Rule の「SSL」設定に相当する Configuration Rule

移行されない設定

次の Page Rules 設定は、他の種類のルールへ移行されません。

  • Disable Performance(この設定は非推奨です)
  • Disable Railgun(この設定は非推奨です。Railgun は利用できなくなっています)
  • Disable Security(この設定は非推奨です)
  • Response Buffering(この設定は非推奨です)
  • Web Application Firewall(この設定は非推奨です。WAF マネージドルールの旧バージョンは非推奨です)

その他の Page Rules 設定は、2025 年中に移行されます。

その他のリソース

フィードバックがある場合は、Community スレッド を参照してください。

役に立ちましたか?