> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Auth0 のカスタムドメインプロキシとして使用するために、Google Cloud Platform（GCP）でロードバランシングを設定する方法を説明します。

# リバースプロキシとして Google Cloud Platform のロードバランシングを設定する

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Auth0 のカスタムドメインは、任意の有料の[サブスクリプションプラン](https://manage.auth0.com/#/tenant/billing/subscription)で利用できます。SSL/TLS 証明書を自分で管理する場合は、**Enterprise** サブスクリプションが必要です。詳しくは、[Auth0 の料金プラン](https://auth0.com/pricing)を参照してください。
</Callout>

GCP では、ロードバランシングをリバースプロキシとして設定できます。次の図は、この構成のコンポーネントを示しています。

* **Google Cloud Platform Load Balancer** は、トラフィックを複数のアプリケーションインスタンスに分散します。
* **Internet Network Endpoint Group** は、Google Cloud 外にあるバックエンドです。詳しくは、[Internet Network endpoint group](https://cloud.google.com/load-balancing/docs/negs/internet-neg-concepts)を参照してください。

<Frame>
  <img src="https://mintcdn.com/translations/6GE5Z24GDCZehiJ9/docs/images/cdy7uua7fh8z/62abKXSoxy0b7uxBfmoWjs/4d6c05060d16d36265e5184ccb3d95b9/gcp-load-balancing-reverse-proxy-diagram.png?fit=max&auto=format&n=6GE5Z24GDCZehiJ9&q=85&s=219ef955acf5686e25275f90a4daeacf" alt="リバースプロキシとして Google Cloud Platform のロードバランシングを使用するフロー図" width="1500" height="664" data-path="docs/images/cdy7uua7fh8z/62abKXSoxy0b7uxBfmoWjs/4d6c05060d16d36265e5184ccb3d95b9/gcp-load-balancing-reverse-proxy-diagram.png" />
</Frame>

1. まだ設定していない場合は、[自己管理証明書を使用したカスタムドメインの設定](/ja/docs/customize/custom-domains/self-managed-certificates)を行います。後で使用するため、**Origin Domain Name** と `cname-api-key` の値を控えておきます。
2. [Auth0 Dashboard > Tenant Settings > Custom Domains](https://manage.auth0.com/#/tenant/custom_domains) で DNS サーバーに TXT レコードを追加してドメインの所有権を確認し、**Verify** をクリックします。
3. GCP でドメインの検証が完了したら、[GCP console](https://console.cloud.google.com) にログインします。
4. **Network Services > Load Balancing** に移動し、**Create Load Balancer** をクリックします。詳しくは、Google Cloud のドキュメントの [Google Cloud Platform Load Balancing](https://cloud.google.com/load-balancing/docs) を参照してください。

   1. **HTTP(S) Load Balancing** を選択します。
   2. インターネットから Auth0 にトラフィックをルーティングする必要があるため、**From Internet to my VMs** を選択します。**Continue** をクリックします。
   3. ロードバランサーに `auth0-reverse-proxy` などの名前を付け、**Create** をクリックします。
5. バックエンドを設定します。

   1. Google Cloud 外にあるバックエンドである internet network endpoint group (NEG) を作成します。詳しくは、Google Cloud のドキュメントの [Internet network endpoint groups overview](https://cloud.google.com/load-balancing/docs/negs/internet-neg-concepts) を参照してください。
   2. バックエンドサービスの設定で、作成した Internet NEG をバックエンドとして選択し、Auth0 テナントの `cname-api-key` と `host` の値 (オリジンドメイン名) を設定します。
   3. **Done** をクリックします。
6. `host` ルールと `path` ルールを設定します。

   1. **Action** で **Route traffic to a single backend** を選択します。
   2. **Host rewrite** に、先ほど保存した Auth0 テナントのオリジンドメイン名を入力します。
   3. **Create** をクリックします。
7. フロントエンドを設定します。

   1. 証明書を作成します。最も簡単な方法は **Google 管理証明書** を選択することです。これにより、Google が SSL 証明書を自動的にプロビジョニングします。
   2. Google 管理証明書を選択しない場合は、証明書の有効期限が切れる前に、認証局で SSL 証明書を更新してアップロードする必要があります。
8. 設定内容を確認して完了します。
   GCP がロードバランサーを設定するまでに 1 分ほどかかります。エラーの原因となる一般的な問題には、次のようなものがあります。

   * **Invalid API key**: `cname-api-key` が GCP から Auth0 に設定されていません。
   * **403 Forbidden**: `host` ヘッダーが GCP から Auth0 に送信されていません。
9. DNS レコードを更新して、[ドメインをロードバランサーに接続](https://cloud.google.com/load-balancing/docs/https/setup-global-ext-https-external-backend#update_dns)します。

<div id="learn-more">
  ## 詳細はこちら
</div>

* [カスタムドメインを使用する機能の設定](/ja/docs/customize/custom-domains/configure-features-to-use-custom-domains)
* [TLS (SSL) のバージョンと暗号スイート](/ja/docs/customize/custom-domains/self-managed-certificates/tls-ssl)
