|
| 1 | +--- |
| 2 | +# cSpell:ignore mycorp |
| 3 | +id: custom-domains |
| 4 | +title: Custom Domains |
| 5 | +sidebar_label: Custom Domains |
| 6 | +description: The Custom Domains page teaches you how to add your own domain in Pomerium Zero and how to use it to build routes to your services. |
| 7 | +--- |
| 8 | + |
| 9 | +# Custom Domains in Pomerium Zero |
| 10 | + |
| 11 | +This document describes **Custom Domains** in Pomerium Zero. |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +When you deploy a cluster in Pomerium Zero, we provision a randomly generated starter subdomain under `pomerium.app` that's assigned to that cluster (for example, `unique-jellyfish-3578.pomerium.app`). |
| 16 | + |
| 17 | +Each starter subdomain comes with its own DNS records and TLS certificates, which makes it easier for new users to quickly build and test routes and policies in Pomerium Zero. |
| 18 | + |
| 19 | +After testing Pomerium Zero with your starter domain, you may want to add a custom domain for use by your cluster's routes to secure your apps and services. |
| 20 | + |
| 21 | +:::info |
| 22 | + |
| 23 | +See the Clusters Concepts page for more information about clusters in Pomerium Zero. |
| 24 | + |
| 25 | +::: |
| 26 | + |
| 27 | +## Custom Domains |
| 28 | + |
| 29 | +In Pomerium Zero, a **Custom Domain** is a wildcard subdomain you can use to build routes in Pomerium. After adding the appropriate record to your DNS provider, Pomerium will automatically provision and renew a TLS certificate for this subdomain. |
| 30 | + |
| 31 | +For example, if you added a custom domain like `mycorp.example.com` to Pomerium Zero, you could build routes like: |
| 32 | + |
| 33 | +- `verify.mycorp.example.com` |
| 34 | +- `internal-tool.mycorp.example.com` |
| 35 | +- `authenticate.mycorp.example.com` |
| 36 | + |
| 37 | +## How to add a custom domain |
| 38 | + |
| 39 | +Add a **wildcard CNAME record** that points to your starter domain. For example: |
| 40 | + |
| 41 | +```bash |
| 42 | +*.mycorp.example.com CNAME unique-jellyfish-3578.pomerium.app |
| 43 | +``` |
| 44 | + |
| 45 | +If you're using a DNS provider like Google's Cloud DNS, you can add the wildcard CNAME record without code: |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +Add the custom domain in the Zero Console: |
| 50 | + |
| 51 | +1. Select **Settings** |
| 52 | +1. In the **Editing Clusters Settings** dashboard, select **Domains** |
| 53 | +1. In the **Custom Domains** field, select the **+** icon to add a domain name |
| 54 | +1. Enter your custom domain |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +If added successfully, you will be able to build routes with your custom domain instead of the starter domain. Pomerium will automatically issue and renew X.509 certificates for this custom domain, which you can verify by the Common Name found in the certificate: |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +You can also review the certificate in the **Certificates** dashboard: |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +### How custom domains work |
| 67 | + |
| 68 | +In order for Pomerium to provision certificates on behalf of a custom domain, you must prove that you control the domain name specified in the certificate through DNS validation. Per the [ACME protocol](https://datatracker.ietf.org/doc/html/rfc8555#section-2), Pomerium uses its own ACME client to communicate with Let's Encrypt, a free Certificate Authority, to validate a domain's DNS records. |
| 69 | + |
| 70 | +Let's Encrypt provides several [challenge types](https://letsencrypt.org/docs/challenge-types/) to validate a domain, including the [DNS-01 challenge](https://letsencrypt.org/docs/challenge-types/#dns-01-challenge). At a high level, this challenge requires that either: |
| 71 | + |
| 72 | +- A `TXT` record must be placed at `_acme-challenge.<YOUR_DOMAIN>` |
| 73 | +- Or, a `CNAME` record must be placed at `_acme-challenge.<YOUR_DOMAIN>` that points to another domain with the `TXT` record |
| 74 | + |
| 75 | +Because Pomerium owns the `pomerium.app` subdomain, we can write the `TXT` record for you. All you need to do is point a wildcard CNAME record to your cluster's starter domain. |
0 commit comments