ゲートウェイの管理
Cloudflare Web3 ゲートウェイは、さまざまな Web3 ネットワークへの HTTP アクセス可能なインターフェースを提供します。ゲートウェイとは、いくつかの方法で対話できます。
To create a gateway using the dashboard:
- Log in to the Cloudflare dashboard ↗.
- Select your account and website.
- Go to Web3.
- Click Create Web3 Gateway.
- Enter the following information:
- Hostname: Enter a hostname to use as your gateway, which has to be a subdomain of the current Cloudflare zone.
- Gateway Description: Enter a description to help distinguish between different gateways.
- Gateway Type: Select a gateway target of IPFS DNSLink, IPFS Universal Path, or Ethereum.
- DNSLink: Only applicable to IPFS gateways, more details at DNSLink.
- Click Deploy.
To create a gateway using the API, send a POST request that includes the following parameters:
name: The hostname that will point to the target gateway via aCNAMErecord.target: The gateway target for the hostname (ethereum,ipfs,ipfs_universal_path).
If you need help with API authentication, refer to Cloudflare API documentation.
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/web3/hostnames" \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>" \--header "Content-Type: application/json" \--data '{ "name": "gateway.example.com", "description": "This is my IPFS gateway.", "target": "ipfs", "dnslink": "/ipns/onboarding.ipfs.cloudflare.com"}'The response contains the complete definition of the new gateway.
{ "success": true, "errors": [], "messages": [], "result": { "id": "<WEB3_GATEWAY_ID>", "name": "gateway.example.com", "description": "This is my IPFS gateway.", "status": "active", "target": "ipfs", "dnslink": "/ipns/onboarding.ipfs.cloudflare.com", "created_on": "<CREATED_ON_DATE>", "modified_on": "<MODIFIED_ON_DATE>" }}When you create a gateway, Cloudflare automatically:
- Creates and adds records to your Cloudflare DNS so your gateway can receive and route traffic appropriately.
- Proxies traffic to that hostname.
- Issues an SSL/TLS certificate to cover the specified hostname.
ゲートウェイを作成した後は、ゲートウェイの説明のみを編集できます。また、IPFS ゲートウェイの場合は、DNSLink フィールドの値も編集できます。
他のフィールドを編集する必要がある場合は、ゲートウェイを削除して新しいものを作成してください。
ダッシュボードを使用してゲートウェイを編集するには:
- Cloudflare ダッシュボード ↗にログインします。
- アカウントとウェブサイトを選択します。
- Web3に移動します。
- 特定のゲートウェイで、編集をクリックします。
- ゲートウェイの説明を更新し、IPFS ゲートウェイを編集している場合は、DNSLinkの値を更新します。
- 再適用をクリックします。
ゲートウェイの特定の設定を編集するには、PATCH リクエストを使用します。
ゲートウェイがエラー ステータスにある場合は、ゲートウェイを更新して、ホスト名に関連付けられた DNS レコードを再作成することを試みるべきです。
ダッシュボードを使用してゲートウェイを更新するには:
- Cloudflare ダッシュボード ↗にログインします。
- アカウントとウェブサイトを選択します。
- Web3に移動します。
- ゲートウェイで、ドロップダウンをクリックして更新を選択します。
APIを使用してゲートウェイを更新するには、空のリクエストボディを持つPATCH リクエストを送信します。
IPFS ユニバーサルパスゲートウェイを設定すると、特定のコンテンツへのアクセスをブロックするために、ゲートウェイのブロックリストにアイテムを追加したい場合があります。
1つ以上のアクセスをブロックする能力があります:
- CIDs (
QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB) - IPFS コンテンツパス (
/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme) - IPNS コンテンツパス (
/ipns/example.com)
ダッシュボードを使用してブロックリストにアイテムを追加するには:
-
Cloudflare ダッシュボード ↗にログインします。
-
アカウントとウェブサイトを選択します。
-
Web3に移動します。
-
特定のゲートウェイで、ドロップダウンをクリックしてブロックリストを選択します。
-
エントリを追加をクリックします。
-
次の情報を入力します:
- ブロックリストエントリタイプ:CIDまたはコンテンツパスを選択します。
- ブロックリストエントリコンテンツ:ブロックするCIDまたはコンテンツパスを追加します。つまり、有効なCIDv0またはCIDv1文字列(CID)であるか、エントリは
/ipfs/または/ipns/で始まる必要があります(コンテンツパス)。 - ブロックリストエントリの説明:ブロックリストエントリを識別するための説明を追加します。
-
追加をクリックします。
APIを使用してブロックリストアイテムを追加するには、POST リクエストを送信します。
ゲートウェイを削除すると、Cloudflareは関連するすべてのホスト名のDNSレコードを自動的に削除します。このアクションはトラフィックに影響を与え、元に戻すことはできません。
ダッシュボードを使用してゲートウェイを削除するには:
- Cloudflare ダッシュボード ↗にログインします。
- アカウントとウェブサイトを選択します。
- Web3に移動します。
- 特定のゲートウェイで、ドロップダウンをクリックして削除を選択します。
- ホスト名を削除をクリックします。
APIを使用してゲートウェイを削除するには、DELETE リクエストを送信します。