跳转到内容
搜索文档

优先流量

最后更新 查看 MarkdownAgent 设置

优先流量 (Prioritized traffic) 允许您定义 Cloudflare One Appliance(前称 Magic WAN Connector)应当优先处理哪些应用程序。不在列表中的应用程序将在优先流量之后排队。

与本地流转流量类似,优先流量也通过检查 DNS 请求来工作。

将 应用程序添加到您的账户

在您能够为 Cloudflare One Appliance 添加或删除 优先流量 应用程序之前,您需要创建一个账户级别的列表,其中包含您想要配置的应用程序。目前,只有通过 API(通过 managed_app_id 端点)才能添加或修改此列表。

要将应用程序添加到您的账户:

发送 POST 请求以向您的账户添加新应用程序。

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 '{
		"managed_app_id": "<APP_ID>",
		"name": "<APP_NAME>",
		"type": "<APP_TYPE>"
	}'
{
	"result": {
		"account_app_id": "eb09v665c0784618a3e4ba9809258fd4",
		"name": "<APP_NAME>",
		"type": "<APP_TYPE>",
	},
	"success": true,
	"errors": [],
	"messages": []
}

您现在可以将此新应用程序添加到您的 Cloudflare One Appliance 中的 优先流量 列表。

将应用程序添加到 Cloudflare One Appliance

您需要为您的每个现有站点配置 优先流量 应用程序,因为这是针对每个站点进行的配置。

  1. 登录 Cloudflare One 仪表板,然后转到 Networks(网络)
  2. 转到 Connectors(连接器) > Appliances(设备) > Profiles(配置文件)
  1. 选择您要配置的 Cloudflare One Appliance > Edit(编辑)
  2. 选择 Traffic Steering(流量引导)
  3. ${props.featureName},选择 ${props.dashName === "CF1 Cloudflare WAN" ? "Create" : "Assign application traffic"}
  4. 从列表中选择一个 or 多个应当绕过 Cloudflare 过滤的应用程序。您也可以使用搜索框。
  1. 选择 Save(保存)

您选择的应用程序的流量将 ${props.whatHappensApp}。

  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": []
    }

从 Cloudflare One Appliance 中删除应用程序

  1. 登录 Cloudflare One 仪表板,然后转到 Networks(网络)
  2. 转到 Connectors(连接器) > Appliances(设备) > Profiles(配置文件)
  1. 选择您想要配置的设备 > Edit(编辑)
  2. 选择 Traffic Steering(流量引导)
  3. ${props.featureName} 中,找到您要删除的应用程序 > 选择其旁边的三个点 > Remove application traffic
  4. (可选)如果您的应用程序有多个页面,您可以使用搜索框快速找到您正在寻找的应用程序。

您需要为您的每个现有站点删除 优先流量 应用程序,因为这是针对每个站点进行的配置。

  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": []
    }

这篇文档对您有帮助吗?