始める
Spectrumはすべての有料プランで利用可能です。ProおよびBusinessプランは選択されたプロトコルのみをサポートし、EnterpriseプランはすべてのTCPおよびUDPベースのトラフィックをサポートします。詳細な設定オプションについては、設定オプションを参照してください。
Spectrumアプリケーションを作成するには、IPアドレス、CNAMEレコード、またはロードバランサーを使用できます。使用する方法に関係なく、ダッシュボードまたはAPIを介してアプリケーションを作成できます。
IPアドレスを使用してSpectrumアプリケーションを作成するには、Cloudflareは通常、CloudflareのIPプールからアプリケーションに任意のIPを割り当てます。独自のIPアドレスを使用したい場合は、BYOIPを使用するか、Static IPを使用できます。この2つのケースでは、これらの機能はダッシュボードでは利用できないため、APIを介してSpectrumアプリケーションを作成する必要があります。APIを使用する場合、フィールドorigin_directにはIPアドレスを入力します。
ダッシュボードを介してアプリケーションを追加する
- Cloudflareダッシュボード ↗にログインします。
- Spectrumを選択します。
- アプリケーションを作成を選択します。これが初めてSpectrumを使用する場合、アプリケーションを作成モーダルが表示されます。
- アプリケーションタイプを選択します。
- ドメインの下に、Spectrumを使用するドメインを入力します。
- エッジポートの下に、Cloudflareがアプリケーションに使用するポートを入力します。
- オリジンの下に、アプリケーションのオリジンIPとポートを入力します。
- アプリケーションがクライアントIPを必要とし、Proxy Protocol ↗をサポートしている場合は、Proxy Protocolsを有効にします。Proxy Protocolは、CloudflareのようなプロキシがクライアントIPをオリジンアプリケーションに送信するための方法です。
- 追加を選択します。
APIを介してアプリケーションを追加する
以下はcurlの例と、APIに送信される関連データです。
APIの例:
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/spectrum/apps" \--header "Authorization: Bearer <API_TOKEN>" \--header "Content-Type: application/json" \--data '{"protocol":"tcp/22","dns":{"type":"CNAME","name":"ssh.example.com"},"origin_direct":["tcp://192.0.2.1:22"],"proxy_protocol":"off","ip_firewall":true,"tls":"full","edge_ips":{"type":"dynamic","connectivity":"all"},"traffic_type":"direct","argo_smart_routing":true}'データの例:
{ "success": true, "errors": [], "messages": [], "result": { "id": "ea95132c15732412d22c1476fa83f27a", "protocol": "tcp/22", "dns": { "type": "CNAME", "name": "ssh.example.com" }, "origin_direct": [ "tcp://192.0.2.1:22" ], "proxy_protocol": "off", "ip_firewall": true, "tls": "full", "edge_ips": { "type": "dynamic", "connectivity": "all" }, "traffic_type": "direct", "argo_smart_routing": true, "created_on": "2014-01-02T02:20:00Z", "modified_on": "2014-01-02T02:20:00Z" }}CNAMEレコードを使用してSpectrumアプリケーションを作成するには、オリジンのホスト名を指す CNAMEレコード ↗をCloudflareホストゾーンに作成する必要があります。これは、ホスト名のオリジンを解決するために必要です。詳細については、DNSレコードの作成を参照してください。CNAMEをオリジンとして使用する場合、Cloudflareはそのゾーンに対して権威を持っている必要があります。APIを使用する場合、origin_dnsフィールドにはCNAMEレコードを入力します。
ダッシュボードを介してアプリケーションを追加する
- Cloudflareダッシュボード ↗にログインします。
- Spectrumを選択します。
- アプリケーションを作成を選択します。これが初めてSpectrumを使用する場合、アプリケーションを作成モーダルが表示されます。
- アプリケーションタイプを選択します。
- ドメインの下に、Spectrumを使用するドメインを入力します。
- エッジポートの下に、Cloudflareがアプリケーションに使用するポートを入力します。
- オリジンの下に、
CNAMEレコード名を入力します。 - 追加を選択します。
APIを介してアプリケーションを追加する
以下はcurlの例と、APIに送信される関連データです。
APIの例:
curl 'https://api.cloudflare.com/client/v4/zones/{zone_id}/spectrum/apps' \--header "Authorization: Bearer <API_TOKEN>" \--header "Content-Type: application/json" \--data '{"dns":{"type":"CNAME","name":"spectrum-cname.example.com"},"ip_firewall":false,"protocol":"tcp/22","proxy_protocol":"off","tls":"off","origin_dns": {"name": "cname-to-origin.example.com", "ttl": 1200}, "origin_port": 22}'データの例:
{ "dns": { "type": "CNAME", "name": "spectrum-cname.example.com" }, "ip_firewall": false, "protocol": "tcp/22", "proxy_protocol": "off", "tls": "off", "origin_dns": { "name": "cname-to-origin.example.com", "ttl": 1200 }, "origin_port": 22}ロードバランサーを使用してSpectrumアプリケーションを作成するには、ダッシュボードまたはAPIを介してロードバランサーを生成する必要があります。詳細については、ロードバランシングのドキュメントを参照してください。
SpectrumアプリケーションのDNS解決に問題が発生しないように、現在のロードバランシングホスト名と同じSpectrumホスト名を使用しないでください。
ダッシュボードを介してアプリケーションを追加する
- Log in to the Cloudflare dashboard ↗.
- Select Spectrum.
- Select Create an Application. If this is your first time using Spectrum, the Create an Application modal appears.
- Select your Application Type.
- Under Domain, enter the domain that will use Spectrum.
- Under Edge Port, enter the port Cloudflare should use for your application.
- Under Origin, select Load Balancer.
- Select the load balancer you want to use from the dropdown. Disabled load balancers will not show on the Load Balancer menu.
- Select Add.
APIを介してアプリケーションを追加する
Below is a curl example and the associated data being posted to the API.
API example:
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/spectrum/apps" \--header "Authorization: Bearer <API_TOKEN>" \--header "Content-Type: application/json" \--data '{"dns":{"type":"CNAME","name":"spectrum-cname.example.com"},"ip_firewall":false,"protocol":"tcp/22","proxy_protocol":"off","tls":"off","origin_dns": {"name": "cname-to-origin.example.com", "ttl": 1200}, "origin_port": 22}'Example data:
{ "dns": { "type": "CNAME", "name": "spectrum-cname.example.com" }, "ip_firewall": false, "protocol": "tcp/22", "proxy_protocol": "off", "tls": "off", "origin_dns": { "name": "cname-to-origin.example.com", "ttl": 1200 }, "origin_port": 22}追加の設定なしで、Cloudflareを介してトラフィックをプロキシできます。Cloudflareを介してトラフィックを実行すると、ダッシュボードにSpectrumからの最後の1分間のトラフィックが表示されます。
フィードバックがある場合は、お知らせください ↗。