RealmDeployDocs
Platform

Custom domains and TLS

Put Keycloak on a hostname of your own with one DNS record. We issue and renew the certificate.

Your Keycloak answers on a hostname in your own domain, such as auth.example.com. Each tenant has one hostname.

Choose the hostname

Choose it before setup and keep it. The hostname is part of every realm's issuer (https://auth.example.com/realms/<realm>), which your apps check in every token. Changing it later means changing every app and identity provider that uses it.

Use a subdomain, such as auth. or login.. The record below is a CNAME, and most DNS providers do not allow one on the bare domain (example.com).

Create the DNS record

When we set up your tenant, we give you the hostname to point at. Create this record at your DNS provider:

TypeNameValue
CNAMEauth.example.comThe hostname we give you

Then tell us it is in place. We check that it resolves to our gateway before we go on, because the certificate cannot be issued until it does.

If your domain has CAA records, they must allow Let's Encrypt (letsencrypt.org).

The certificate

  • Issued by Let's Encrypt for your hostname, once your record resolves to us. The check runs over plain HTTP on your hostname, which is why the record must be in place first.
  • Renewed automatically before it expires. We watch the certificate, and an alert tells us if a renewal fails or expiry gets close.
  • HTTPS only. Plain HTTP requests to your hostname are redirected to HTTPS.

Keep the record pointed at us for as long as you use the tenant. Renewal fails if it stops resolving to our gateway, and we tell you if that happens.

Moving an existing hostname

If auth.example.com points at a Keycloak you run today, the switch is part of the migration: you lower the record's TTL a day ahead, then point it at us during the cutover. See Moving from a self-hosted Keycloak.

On this page