Skip to content

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

優先トラフィック

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

優先トラフィック(Prioritized traffic)では、Cloudflare One Appliance(旧 Magic WAN Connector)が先に処理するアプリケーションを指定できます。リストにないアプリケーションは、優先トラフィックの後ろにキューイングされます。

ブレイクアウトトラフィックと同様に、優先トラフィックも DNS リクエストの検査で動作します。

アカウントにアプリケーションを追加する

Cloudflare One Appliance の優先トラフィックにアプリケーションを追加または削除する前に、設定したいアプリケーションのアカウントレベルのリストが必要です。このリストには、次の 2 種類のアプリケーションがあります。

  • Cloudflare-managed applications — Cloudflare があらかじめ認識しているアプリケーションのカタログです。アカウントにすでに存在し、作成する必要はありません。アプリケーショントラフィックを割り当てるときに直接選びます。
  • Custom applicationshostnameIP subnetsource subnet のいずれか(または組み合わせ)で定義するアプリケーションです。ダッシュボード、または Create an account app エンドポイントから、カスタムアプリケーションの作成、編集、削除ができます。

カスタムアプリケーションを作成、編集、削除する

  1. Connectors ページを開きます。
Connectors を開く ↗
  1. Appliances タブ > Profiles を開きます。
  2. 設定する Cloudflare One Appliance を選び、Edit を選択します。
  3. Traffic Steering を選択します。
  4. Prioritized trafficAssign application traffic を選択します。
  5. Custom applicationsAdd を選び、新しいカスタムアプリケーションを作成して、次を入力します。
    • Name — アプリケーションの表示名です。
    • Category — 任意のグループラベルです。例: ProductivityVideo conferencing
    • HostnamesIP subnetsSource subnets のうち少なくとも 1 つ — このアプリケーションを識別するトラフィックです。ホスト名は有効な FQDN である必要があります(例: auth.example.com)。IP サブネットとソースサブネットは、有効な IPv4 CIDR である必要があります(例: 10.0.0.0/24)。単一アドレスには /32 サフィックスが必要です。IPv6 はまだ未対応です。
  6. Add application を選択します。
  7. 既存のカスタムアプリケーションを変更または削除するには、Custom applications テーブルで対象の横の 三点リーダー を選び、Edit または Delete を選択します。

アカウントにカスタムアプリケーションを作成する POST リクエストを送信します。次の例では、任意の照合条件を 3 つとも使っています。

Required API token permissions

At least one of the following token permissions is required:
  • Magic WAN Write
  • Magic Transit Write
Create a new Appbash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/magic/apps" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "Example application",
		"type": "Productivity",
		"hostnames": [
				"auth.example.com"
		],
		"ip_subnets": [
				"192.0.2.0/24"
		],
		"source_subnets": [
				"10.0.0.0/24"
		]
	}'
{
	"result": {
		"account_app_id": "eb09v665c0784618a3e4ba9809258fd4",
		"name": "Example application",
		"type": "Productivity",
		"hostnames": ["auth.example.com"],
		"ip_subnets": ["192.0.2.0/24"],
		"source_subnets": ["10.0.0.0/24"]
	},
	"success": true,
	"errors": [],
	"messages": []
}

この新しいアプリを、Cloudflare One Appliance の優先トラフィックリストに追加できます。

Cloudflare One Appliance にアプリケーションを追加する

優先トラフィックのアプリケーションは、既存の各サイトに対して設定します。サイト単位の設定です。

  1. Connectors ページを開きます。
Connectors を開く ↗
  1. Appliances タブ > Profiles を開きます。

  2. 設定する Cloudflare One Appliance を選び、Edit を選択します。

  3. Traffic Steering を選択します。

  4. Prioritized trafficAssign application traffic を選択します。

  5. Custom applications または Cloudflare-managed applications から、先に処理するアプリケーションを 1 つ以上選びます。検索ボックスも使えます。このパネルを離れずに新しいカスタムアプリケーションを定義するには Add を選びます。手順は カスタムアプリケーションを作成、編集、削除する を参照してください。

  6. Save を選択します。

選んだアプリケーションのトラフィックは、Connector が先に処理します。

  1. アカウントに関連付けられたアプリケーションを一覧する GET リクエスト を送信します。

    Required API token permissions

    At least one of the following token permissions is required:
    • Magic WAN Write
    • Magic WAN Read
    • Magic Transit Read
    • Magic Transit Write
    List Appsbash
    curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/magic/apps" \
    	--request GET \
    	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
    	{
    		"result": [
    			{
    				"managed_app_id": "<APP_ID>",
    				"name": "<APP_NAME>",
    				"type": "File Sharing",
    				"hostnames": [
    					"<app_name.com>",
    					"<app-name.info>"
    				]
    			}
    		]
    	}

    追加したいアプリケーションの "managed_app_id" の値を控えます。

  2. 優先トラフィックポリシーに新しいアプリを追加する POST リクエストを送信します。

    Required API token permissions

    At least one of the following token permissions is required:
    • Magic WAN Write
    • Magic Transit Write
    Create a new App Configbash
    curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/magic/sites/$SITE_ID/app_configs" \
    	--request POST \
    	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    	--json '{
    		"managed_app_id": "<MANAGED_APP_ID>",
    		"breakout": true
    	}'
    {
    	"result": {
    		"account_app_id": "<APP_ID>",
    		"name": "<APP_NAME>",
    		"type": "<BREAKOUT_OR_PRIORITY>"
    	},
    	"success": true,
    	"errors": [],
    	"messages": []
    }

Source subnets で定義したカスタムアプリケーションも、同じ方法で優先指定できます。ソースベースの照合条件の全体は ソースによるブレイクアウト を参照してください。

Cloudflare One Appliance からアプリケーションを削除する

  1. Connectors ページを開きます。
Connectors を開く ↗
  1. Appliances タブ > Profiles を開きます。

  2. 設定する Appliance を選び、Edit を選択します。

  3. Traffic Steering を選択します。

  4. Prioritized traffic で削除するアプリケーションを探し、横の 三点リーダー を選んで Remove application traffic を選択します。

  5. (任意)アプリケーションが複数ページある場合は、検索ボックスで目的のアプリケーションをすばやく探せます。

優先トラフィックのアプリケーションは、既存の各サイトから削除します。サイト単位の設定です。

  1. サイトに関連付けられたアプリケーションを一覧する GET リクエスト を送信します。

    Required API token permissions

    At least one of the following token permissions is required:
    • Magic WAN Write
    • Magic WAN Read
    • Magic Transit Read
    • Magic Transit Write
    List App Configsbash
    curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/magic/sites/$SITE_ID/app_configs" \
    	--request GET \
    	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
    	{
    		"result": [
    			{
    				"id": "<APP_ID>",
    				"site_id": "<SITE_ID>",
    				"managed_app_id": "<APP_NAME>",
    				"breakout": true
    			}
    		]
    	}

    削除するアプリケーションの "id" の値を控えます。

  2. 優先トラフィックポリシーからアプリケーションを削除する DELETE リクエストを送信します。

    curl "https://api.cloudflare.com/client/v4/accounts/%7Baccount_id%7D/magic/sites/%7Bsite_id%7D/app_configs/%7Bid%7D" \
    	--request DELETE
    {
    		"result": {
    				"id": "<APP_ID>",
    				"site_id": "<SITE_ID>",
    				"managed_app_id": "<APP_NAME>",
    				"breakout": true
    		},
    		"success": true,
    		"errors": [],
    		"messages": []
    }

役に立ちましたか?