コンテンツにスキップ

ホスト名ごとの認証されたオリジンプル

ホスト名ごとに認証されたオリジンプルを有効にすると、指定されたホスト名へのすべてのプロキシトラフィックがオリジンのウェブサーバーで認証されます。Cloudflareからの接続を認証するために、プライベートPKIのクライアント証明書を使用できます。

It is not possible to set up per-hostname authenticated origin pulls with the Cloudflare certificate.


1. カスタム証明書をアップロードする

まず、APIの指示に従ってCloudflareにカスタム証明書をアップロードしますが、/origin_tls_client_auth/hostnames/certificatesエンドポイントを使用します。

APIの応答で、証明書のidを保存してください。これはステップ4で必要になります。

2. オリジンがクライアント証明書を受け入れるように設定する

With the certificate installed, set up your origin web server to accept client certificates.

Check the examples below for Apache and NGINX or refer to your origin web server documentation - e.g. HAProxy, Traefik, Caddy.

Apache example

SSLVerifyDepth 1
SSLCACertificateFile /path/to/origin-pull-ca.pem

For this example, you would have saved your certificate to /path/to/origin-pull-ca.pem.

NGINX example

ssl_verify_client optional;
ssl_client_certificate /etc/nginx/certs/cloudflare.crt;

For this example, you would have saved your certificate to /etc/nginx/certs/cloudflare.crt.

At this point, you may also want to enable logging on your origin so that you can verify the configuration is working.

3. 認証されたオリジンプルを有効にする(グローバルに)

Then, enable the Authenticated Origin Pulls feature as an option for your Cloudflare zone.

This step sets the TLS Client Auth to require Cloudflare to use a client certificate when connecting to your origin server.

To enable Authenticated Origin Pulls in the dashboard:

  1. Log in to your Cloudflare account and go to a specific domain.
  2. Go to SSL/TLS > Origin Server.
  3. For Authenticated Origin Pulls, switch the toggle to On.

4. ホスト名のために認証されたオリジンプルを有効にする

Cloudflare APIを使用して、特定のホスト名のために認証されたオリジンプルを有効にするPUTリクエストを送信します。

ステップ2でオリジンのロギングを設定していた場合、認証されたオリジンプルが機能していることをテストして確認してください。

5. オリジンでの検証チェックを強制する

Once you can confirm everything is working as expected for your specific origin setup, configure your origin to enforce the authentication.

Apache example

SSLVerifyClient require

NGINX example

ssl_verify_client on;

After completing the process, you can use curl to send requests directly to your origin IPs, verifying that the requests fail due to certificate validation being enforced.

6. (オプション)ホスト名レベルの認証されたオリジンプル証明書のアラートを設定する

AOP証明書が期限切れになる前に通知を受け取るためのアラートを設定できます。

Refer to Cloudflare Notifications for more information on how to set up an alert.