コンテンツにスキップ

SaaSのためのCloudflareの設定


Before you begin

Before you start creating custom hostnames:

  1. Add your zone to Cloudflare 無料プランで。
  2. Enable Cloudflare for SaaS for your zone.
  3. Review the Hostname prioritization guidelines. Wildcard custom hostnames behave differently than an exact hostname match.
  4. (optional) Review the following documentation:

初期設定

When you first enable Cloudflare for SaaS, you need to perform a few steps prior to creating any custom hostnames.


ステップ1 — フォールバックオリジンの作成

The fallback origin is where Cloudflare will route traffic sent to your custom hostnames (must be proxied).

To create your fallback origin:

  1. Create a proxied A, AAAA, or CNAME record pointing to the IP address of your fallback origin (where Cloudflare will send custom hostname traffic).

TypeNameIPv4 addressProxy status
Aproxy-fallback192.0.2.1Proxied
  1. Designate that record as your fallback origin.
  1. Log into the Cloudflare dashboard.
  2. Select your account and zone.
  3. Go to SSL/TLS > Custom Hostnames.
  4. For Fallback Origin, enter the hostname for your fallback origin.
  5. Select Add Fallback Origin.
  1. Once you have added the fallback origin, confirm that its status is Active.

ステップ2(オプション) — CNAMEターゲットの作成

CNAMEターゲット — オプションですが、強く推奨されます — は、顧客がトラフィックをルーティングするためのフレンドリーで柔軟な場所を提供します。customers.<SAAS_PROVIDER>.comのようなサブドメインを使用することをお勧めします。

作成したプロキシ付きのCNAMEが、あなたのCNAMEターゲットをフォールバックオリジンにポイントするようにします(*.customers.saasprovider.comのようなワイルドカードも可能です)。

タイプ名前IPv4アドレスプロキシステータス
CNAME.customersproxy-fallback.saasprovider.comプロキシ済み

ホスト名ごとの設定

You need to perform the following steps for each custom hostname.

Step 1 — Plan for validation

Before you create a hostname, you need to plan for:

  1. Certificate validation: Upon successful validation, the certificates are deployed to Cloudflare’s global network.
  2. Hostname validation: Upon successful validation, Cloudflare proxies traffic for this hostname.

You must complete both these steps for the hostname to work as expected.

Step 2 — Create custom hostname

After planning for certification and hostname validation, you can create the custom hostname.

To create a custom hostname:

  1. Log in to the Cloudflare dashboard and select your account.
  2. Select your Cloudflare for SaaS application.
  3. Navigate to SSL/TLS > Custom Hostnames.
  4. Click Add Custom Hostname.
  5. Add your customer’s hostname app.customer.com and set the relevant options, including:
  6. Click Add Custom Hostname.

ステップ3 — 顧客にCNAMEレコードを作成させる

カスタムホスト名の設定を完了するために、顧客は自分の権威DNSで、あなたのCNAMEターゲットを指すCNAMEレコードを設定する必要があります1

顧客のCNAMEレコードは次のようになります:

www.mystore.com CNAME customers.saasprovider.com

このレコードは、次のようにトラフィックをルーティングします:

flowchart TD
accTitle: CNAMEターゲットを使用したトラフィックルーティングの仕組み
A[<code>www.mystore.com</code>へのリクエスト] --> B[<code>customers.saasprovider.com</code>]
B --> C[<code>proxy-fallback.saasprovider.com</code>]

www.mystore.comへのリクエストは、あなたのCNAMEターゲット(customers.saasprovider.com)に行き、そこからフォールバックオリジン(proxy-fallback.saasprovider.com)にルーティングされます。

サービスの継続

If your customer is also using Cloudflare for their domain, they should keep their DNS record pointing to your SaaS provider in place for as long as they want to use your service.

For more details, refer to Remove custom hostnames.

Footnotes

  1. If you have regional services set up for your custom hostnames, Cloudflare always uses the processing region associated with your DNS target record (instead of the processing region of any custom origins).