コンテンツにスキップ

API ルーティング

API Shield Routing は、顧客が異なるパスやホストを持つ異なるバックエンドサービスにリクエストをルーティングする、統一された外部向けAPIを作成できるようにします。

プロセス

You must add Source Endpoints to Endpoint Management through established methods, including uploading a schema, via API Discovery, or by adding manually, before creating a route.

To create a route, you will need the operation ID of the Source Endpoint. To find the operation ID in the dashboard:

  1. Log in to the Cloudflare dashboard and select your account and domain.
  2. Select Security > API Shield.
  3. Filter the endpoints to find your Source Endpoint.
  4. Expand the row for your Source Endpoint and note the operation ID field.
  5. Select the copy icon to copy the operation ID to your clipboard.

ソースエンドポイントがエンドポイント管理に追加されたら、次の手順を使用して任意の操作IDでルートを作成および確認します。

ルートを作成する

  1. Log in to the Cloudflare dashboard and select your account and domain.
  2. Go to Security > API Shield.
  3. In Endpoint Management, select an existing endpoint and expand its details.
  4. Under Routing, select 作成 ルート.
  5. Enter the target URL or IP address to route your endpoint to.
  6. Select Deploy route.

ルートを編集する

  1. Log in to the Cloudflare dashboard and select your account and domain.
  2. Go to Security > API Shield.
  3. In Endpoint Management, select an existing endpoint and expand its details.
  4. Under Routing, select 編集 ルーティング.
  5. Enter the target URL or IP address to route your endpoint to.
  6. Select Deploy route.

ルートを削除する

  1. Cloudflare ダッシュボードにログインし、アカウントとドメインを選択します。
  2. セキュリティ > API Shieldを選択します。
  3. エンドポイント管理で、既存のエンドポイントを選択し、その詳細を展開します。
  4. ルーティングの下で、ルーティングを編集を選択します。
  5. ルートを削除を選択します。

ルートをテストする

ソースエンドポイントにリクエストを送信した後、ターゲットエンドポイントを直接呼び出したかのようにバックエンドサービスの内容が表示されるはずです。

API Shield が予期しない結果を返す場合は、ソースエンドポイントのホスト、メソッド、パスを確認し、ルートを確認してターゲットエンドポイントの値が正しいことを確認してください。

利用可能性

API Shield Routing は現在オープンベータ版であり、API Shield に登録されたエンタープライズ顧客のみが利用可能です。API Shield を購入していないエンタープライズ顧客は、Cloudflare ダッシュボードで契約外サービスとしてAPI Shieldをプレビューするか、アカウントチームに連絡することができます。

制限事項

The Target Endpoint cannot be routed to a Worker if the route is to the same zone.

You cannot change the method of a request. For example, a GET Source Endpoint will always send a GET request to the Target Endpoint.

You must use all of the variables in the Target Endpoint that appear in the Source Endpoint. For example, routing /api/{var1}/users/{var2} to /api/users/{var2} is not allowed and will result in an error since {var1} is present in the Source Endpoint but not in the Target Endpoint.