在 2026 年 10 月 5 日 ,两项变更将在 Zero Trust Networks API 和 Cloudflare Tunnel API 中生效:移除经过 CIDR 编码的路由终点,且 tunnel list 和 get 响应将不再包含 connections 字段。如果您通过 API、cloudflared、Terraform 或其他集成管理私有网络路由或读取 tunnel 连接详情,请阅读以下部分中的变更说明并在移除日期之前完成迁移。
经过 CIDR 编码的路由终点已被弃用,转而使用目前已存在的基于标准 route_id 的终点。这两组终点都是通过 Cloudflare Tunnel 或 Cloudflare Mesh 路由私有网络(API 仍将 Mesh 节点称为 warp_connector)— 仅请求形状(request shape)发生了变化。
已弃用的终点(将于 2026 年 10 月 5 日移除):
替代终点:
通过调用列出 tunnel 路由 获取每个路由的 route_id,或者在首次使用替代终点创建路由时从响应中读取它。
更新任何直接调用经过 CIDR 编码的终点的脚本、后端服务或 CI/CD 流水线。
如果您使用 cloudflared tunnel route ip add | delete 命令管理路由,请将 cloudflared 升级到最新版本 ↗ 。
如果您使用 Terraform 管理路由,请确保您使用的是最新版本的 cloudflare_zero_trust_tunnel_cloudflared_route ↗ 资源以及 Cloudflare Terraform 提供商 ↗ 。
# Before: create a route by URL-encoding the CIDR into the path
curl https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /teamnet/routes/network/172.16.0.0%2F16 \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
-d '{"tunnel_id": "' $TUNNEL_ID '", "comment": "Example comment for this route."}'
# After: create a route with the network in the request body
curl https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /teamnet/routes \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
-d '{"network": "172.16.0.0/16", "tunnel_id": "' $TUNNEL_ID '", "comment": "Example comment for this route."}'
# After: update or delete a route using its route_id
curl -X PATCH https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /teamnet/routes/ $ROUTE_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
-d '{"comment": "Updated comment for this route."}'
curl -X DELETE https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /teamnet/routes/ $ROUTE_ID \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN "
Cloudflare Tunnel 和 Cloudflare Mesh 连接
自同一天起,将从 Cloudflare Tunnel 和 Cloudflare Mesh 节点(cfd_tunnel 和 warp_connector API 资源)的 list 和 get 响应中移除 connections 数组。请查询专用的连接终点,而不是从 tunnel 或节点对象中读取该字段。
这会影响:
从特定于 tunnel 的连接终点获取连接详情,而不是从 list 或 get 响应中解析。对于 Cloudflare Tunnel,请调用 GET /accounts/{account_id}/cfd_tunnel/{tunnel_id}/connections 。对于 Cloudflare Mesh,请调用 GET /accounts/{account_id}/warp_connector/{tunnel_id}/connections 。
# Before: read connections off the tunnel object
curl https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /cfd_tunnel/ $TUNNEL_ID \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN "
# After: query connections directly
curl https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /cfd_tunnel/ $TUNNEL_ID /connections \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN "
更新任何从 tunnel list 或 get 响应中解析 connections 的仪表板、监控脚本或自动化。cloudflared 和 Cloudflare Terraform 提供商不读取此字段,因此它们的这一部分更新不需要做任何更改。
响应更小、速度更快。 具有许多连接的 Cloudflare Tunnel 和 Cloudflare Mesh 节点不再膨胀每次 list 和 get 调用 — 仅在您需要时才获取连接详情。
静态或标识路由的单一方式。 统一使用 route_id 消除了对路径中 CIDR 范围进行 URL 编码的需要,并且与 Zero Trust Networks API 中所有其他资源的寻址方式一致。
跨 API 的一致性。 这两项变更使这些终点与 Cloudflare 针对资源标识符和嵌套详情终点的标准 REST 约定保持一致。
要了解更多信息,请参阅 Zero Trust Networks API 、Cloudflare Tunnel API 和路由 文档。