Use your own domain
An issuer answers at a host Authwise gives it, such as
example.id.authwise.com. To serve it at a hostname you own, such as
login.example.com, you add the hostname to the tenant, create two DNS
records, and bind the issuer to the hostname at a path. Authwise obtains
the TLS certificate for the hostname and renews it on its own edge for as
long as the records stay in place.
What you get:
- Each binding is an issuer URL of its own. Sign-in pages, discovery,
and tokens at
login.example.comcarryiss = https://login.example.com. - The Authwise host keeps working.
example.id.authwise.comkeeps answering with its owniss, and neither host redirects to the other. Relying parties configured against the Authwise host are unaffected, and you can move them to the new issuer URL one at a time. - Several issuers on one hostname. A hostname belongs to the tenant,
not to an issuer. Bind one issuer at the root and another at a path such
as
/partners, and each is its own issuer URL. See Serve several issuers on one hostname. - Sign-in through identity providers at the hostname. A sign-in at
login.example.comthrough Google, Microsoft, Okta, or another identity provider returns to a redirect URI atlogin.example.com. You add that redirect URI at each provider before the hostname takes traffic. See step 4 of Add a domain. - No certificate work on your side. There is no certificate to upload, no expiry to track, and no renewal to run.
Before you begin
Section titled “Before you begin”- The Business plan or above. Below it, adding a hostname of your own
is refused with the reason
PLAN_REQUIRED. - Identity server 1.84 or later,
awctl0.40 or later, Terraform provider 0.32 or later, and the console that ships with them. Earlier releases attach a hostname to an issuer instead of the tenant; see Upgrading from an earlier release. - A tenant administrator seat, or a service account holding
tenant.admin. See Service accounts. - A subdomain, not an apex. The traffic record is a CNAME, and a CNAME
can’t sit at a zone apex such as
example.com. Use a subdomain such aslogin.example.com. If it must be the apex, your DNS provider’s CNAME flattening (Cloudflare calls it that; others call itALIASorANAME) can stand in. - Access to the hostname’s DNS zone, to create two CNAME records.
- Passkeys, decided in advance. See Passkeys before you bind an issuer whose users already have passkeys to a new hostname.
How the pieces fit
Section titled “How the pieces fit”| Resource | What it is | Scope |
|---|---|---|
| Domain | A hostname the tenant serves from. The Authwise host is a native domain. A hostname you own is a custom domain, with a state, two DNS records, and a certificate. Nothing on a domain names an issuer. Every domain has an ID (d-…). | Tenant |
| Binding | Where an issuer answers: one of the tenant’s domains and a path. The URL https://HOSTNAME/PATH is the iss claim in every token minted there. One hostname and path serve one issuer; an issuer can have no binding, one, or several. Every binding has an ID (idb-…). | Issuer |
An issuer with no binding answers nowhere. A binding on a custom domain starts answering when the domain reaches Activating; a binding on a native domain answers at once.
Among an issuer’s bindings, one is the host that mailed links carry: the invitation, the password reset, and the address verification. See Choose the host mailed links use.
The rules
Section titled “The rules”These four rules prevent every outage this feature can cause:
- Challenge first, traffic at Activating. Create the challenge record, wait for the domain to show Activating, and then create the traffic record. At Activating the certificate is issued and attached, and the hostname already routes to its bound issuers, so the first request arrives at a working certificate and nobody sees a TLS error. Don’t wait for Active before you create the traffic record: a domain becomes Active only after Authwise finds the traffic record in public DNS, so without it the domain stays Activating.
- Both records DNS-only. On Cloudflare, set both records to DNS
only (the grey cloud,
proxied = false). A proxied record puts Cloudflare in front of Authwise, which fails: Authwise can’t see the real hostname, and the certificate authority can’t see the challenge record. - Keep the challenge record for as long as the domain exists. Renewal depends on it. Deleting it doesn’t break anything at once, but the domain becomes Degraded, and the certificate expires and isn’t replaced.
- A subdomain, or flattening at the apex. A CNAME can’t sit at a zone
apex. Authwise refuses an apex with the reason
HOSTNAME_APEX.
Add a domain
Section titled “Add a domain”To serve an issuer at your own hostname, follow these steps.
-
Add the hostname to the tenant as a custom domain.
With
awctl, in the tenant’s context:Terminal window awctl identity domains create --hostname login.example.com --customWith Terraform:
resource "authwise_domain" "login" {custom = truehostname = "login.example.com"}Without
custom, the hostname is added as a native domain, an Authwise host with no DNS records and no certificate of its own.Authwise refuses a hostname that is already claimed anywhere in the Authwise installation, including by a domain of yours that is still being deleted, with the reason
HOSTNAME_CLAIMED. It refuses a hostname that is already an Authwise host withHOSTNAME_IS_ISSUER; bind the issuer to that native domain instead. An installation without a domain controller refuses to add a custom domain, with the reasonDOMAINS_UNAVAILABLE. -
Read the two DNS records. They appear within about thirty seconds:
Purpose Name Type Value challenge_acme-challenge.login.example.comCNAMEA value ending in .authorize.certificatemanager.googtrafficlogin.example.comCNAMEThe installation’s edge name, shown as the domain’s traffic target In the console, open Domains and choose the hostname. Its page shows the state, the progress, and the records with their values. With
awctl,createprints them. To print them again, run:Terminal window awctl identity domains get DOMAIN_IDReplace
DOMAIN_IDwith the domain’s identifier (d-…), the last segment of thenamethatcreateprints. To find it later, list the tenant’s domains; a hostname of your own shows ascustomwith its state, and an Authwise host asnative:Terminal window awctl identity domains listID HOSTNAME KIND STATE ISSUER_ID PRODUCTd-g3mxasgay3gi awctl69-check.kit-probe.example custom PENDING_DNSd-g3mxasgay3gx awctl69chk.id.preview.authwise.com nativeAdd
--jsonor--yamlfor the whole resource. In Terraform the records are thedns_recordsattribute and the edge name istraffic_target. -
Create the challenge record at your DNS provider, DNS-only.
-
If the issuer’s realms sign users in through identity providers, such as Google, Microsoft, or Okta, add the hostname’s redirect URI to every one of them, and keep the existing redirect URI:
https://HOSTNAME/api/v1/authorize/user-core/provider-returnReplace
HOSTNAMEwith the domain’s hostname, such aslogin.example.com. For an issuer bound below a path, put the path before/api, such ashttps://login.example.com/partners/api/v1/authorize/user-core/provider-return.Each binding is its own issuer, so a sign-in at
login.example.comsends the provider this redirect URI rather than the one for the Authwise host. A provider refuses a redirect URI it doesn’t have registered, and the sign-in fails; Google, for example, answersredirect_uri_mismatch. Add it before you create the traffic record in step 7, because sign-in moves to the hostname as soon as that record resolves. Until the domain is Active,awctl’screateandgetprint this redirect URI with the records. The console’s domain page lists it under Sign-in provider redirect URI, with the providers to update.SAML providers follow the hostname the same way: the service provider’s entity ID and its assertion consumer service URL both belong to the hostname the partner reaches. For each SAML provider in the issuer’s realms, register the hostname’s service provider metadata at the identity provider as a second service provider entry:
https://HOSTNAME/saml/sp/PROVIDER_ID/metadataReplace
PROVIDER_IDwith the SAML provider’s identifier. The metadata names the assertion consumer service URL,https://HOSTNAME/saml/sp/PROVIDER_ID/callback. Keep the existing entry until no sign-ins use the Authwise host. Most identity providers allow one entity ID per application, so expect to create a second application. The console’s domain page lists the metadata URL under SAML service-provider metadata. -
Bind the issuer to the domain. You can do this before the domain is Active; the binding answers once the domain reaches Activating.
In the console, open the issuer, choose Hosts, then Add a host. In Domain, pick the hostname. Leave Path empty to bind the issuer at the root of the hostname, or enter a path such as
/partners. Click Add host.With
awctl:Terminal window awctl identity issuer-domain-bindings create --issuer-id ISSUER_ID --domain login.example.comReplace
ISSUER_IDwith the issuer’s identifier (i-…).--domaintakes the hostname;--domain-idtakes the domain’s identifier instead.--pathis empty for the root (the default), or a path such as/partners.With Terraform:
resource "authwise_issuer_domain_binding" "login" {issuer_id = authwise_issuer.main.issuer_iddomain_id = authwise_domain.login.domain_id}The binding’s
urlattribute is the issuer URL,https://login.example.com.Authwise refuses a binding at a hostname and path where another issuer already answers, with the reason
BINDING_TAKEN; the refusal names the issuer. It refuses a domain of another tenant, and a custom Guard address (a domain withproductset), withDOMAIN_NOT_BINDABLE.To see where an issuer answers, open its Hosts tab in the console, or run:
Terminal window awctl identity issuers describe ISSUER_IDNAME DOMAIN_NAME PREFERRED_BINDING_IDtenants/t-g3mxi3jjxzb4/issuers/i-g3mxca1sifpt awctl69chk.id.preview.authwise.combindings:ID ISS ROUTABLE PREFERREDidb-g3mxca1sifpz https://awctl69chk.id.preview.authwise.com yes yesidb-g3mxca1sifq2 https://awctl69-check.kit-probe.example not yet noClient ID metadata documents: offROUTABLEisnot yeton a custom domain whose certificate isn’t live. -
Wait until the domain shows Activating (
PROVISIONING). The domain passes through Waiting for DNS and Issuing certificate first. Certificate issuance usually takes a few minutes after the challenge record resolves. The console’s domain page shows the progress. Withawctl, run thegetcommand from step 2 and readstate:name tenants/TENANT_ID/domains/DOMAIN_IDhostname login.example.comkind customstate PROVISIONINGtraffic target EDGE_NAMEbound issuers:ISSUER BINDING ISSISSUER_ID idb-g2abcdefgh02 https://login.example.comNAME TYPE VALUE PURPOSE_acme-challenge.login.example.com CNAME CHALLENGE_ID.2.authorize.certificatemanager.goog challengelogin.example.com CNAME EDGE_NAME trafficAdd the challenge record first, and the traffic record once the domain is PROVISIONING (certificate issued); ACTIVE follows on the next probe. On Cloudflare both DNS-only (grey cloud).The certificate is issued: add the traffic record now. ACTIVE follows once it resolves publicly.CHALLENGE_IDstands for the identifier Authwise generates for the domain’s challenge record, andEDGE_NAMEfor the installation’s edge name. -
Create the traffic record, DNS-only.
The domain becomes Active (
ACTIVE) on Authwise’s next check after the traffic record has propagated in public DNS. Withawctl, add--waitto thecreatein step 1: it prints the records on standard output, then reports each change of state on standard error while you create the records. When it reachesPROVISIONING, it adds this line, and you create the traffic record:The certificate is issued: add the traffic record now. ACTIVE follows once it resolves publicly.--waitexits zero when the domain isACTIVE, and non-zero if the domain endsFAILED,DEGRADED, orDELETING, or after 30 minutes (change that with--timeout). -
Optional: move relying parties to the new issuer URL,
https://login.example.com. Each one picks up the newissfrom the new discovery document. -
Optional: make the new hostname the one mailed links carry. See Choose the host mailed links use.
With Terraform and Cloudflare
Section titled “With Terraform and Cloudflare”One terraform apply can do every step in order. The domain’s create
returns once dns_records is known. An authwise_domain_activation
between the two records waits until the domain is PROVISIONING or
ACTIVE, and only then does Terraform create the traffic record. It needs
the Authwise provider 0.32 or later, and version 4 of the Cloudflare
provider, whose record resource is cloudflare_record.
Before you run the apply that creates the traffic record, add the hostname’s redirect URI to each identity provider, as in step 4 of Add a domain. That step happens outside this configuration, unless the identity provider’s own Terraform provider manages its redirect URIs, in which case add it there.
terraform { required_providers { authwise = { source = "authwisecom/authwise" version = ">= 0.32.0" } cloudflare = { source = "cloudflare/cloudflare" version = "~> 4.0" } }}
resource "authwise_domain" "login" { custom = true hostname = "login.example.com"}
resource "authwise_issuer_domain_binding" "login" { issuer_id = authwise_issuer.main.issuer_id domain_id = authwise_domain.login.domain_id}
locals { login_records = { for r in authwise_domain.login.dns_records : r.purpose => r }}
resource "cloudflare_record" "login_challenge" { zone_id = var.zone_id name = local.login_records["challenge"].name type = local.login_records["challenge"].type content = local.login_records["challenge"].value proxied = false}
resource "authwise_domain_activation" "login" { domain = authwise_domain.login.name depends_on = [cloudflare_record.login_challenge]}
resource "cloudflare_record" "login_traffic" { zone_id = var.zone_id name = local.login_records["traffic"].name type = local.login_records["traffic"].type content = local.login_records["traffic"].value proxied = false
depends_on = [authwise_domain_activation.login]}
# Optional: mailed links carry the new hostname once it serves.resource "authwise_issuer_preferred_binding" "main" { issuer = authwise_issuer.main.name binding_id = authwise_issuer_domain_binding.login.issuer_domain_binding_id
depends_on = [authwise_domain_activation.login]}Replace var.zone_id with the Cloudflare zone of the hostname.
The activation waits up to 30 minutes; set timeouts { create = "60m" }
on it to wait longer. It doesn’t wait for ACTIVE, because the domain
reaches ACTIVE only after the traffic record that depends on the
activation resolves. The activation’s state attribute records which of
the two states it saw. The domain becomes ACTIVE on Authwise’s next check
after the apply, once the traffic record has propagated.
If the domain ends Failed, the apply stops with the cause, and the traffic record isn’t created. Fix the cause and apply again.
Serve several issuers on one hostname
Section titled “Serve several issuers on one hostname”A hostname belongs to the tenant, so several issuers can share it. Each
issuer takes its own path, and each is its own issuer URL: an issuer bound
at the root of login.example.com has iss = https://login.example.com,
and one bound at /partners has iss = https://login.example.com/partners.
Every endpoint of the second issuer sits under its path: its discovery
document is https://login.example.com/partners/.well-known/openid-configuration,
and its sign-in pages are under https://login.example.com/partners/.
To bind an issuer at a path, enter the path in Path on the Hosts tab, or pass it on the command line:
awctl identity issuer-domain-bindings create --issuer-id PARTNER_ISSUER_ID --domain login.example.com --path /partnersWith Terraform:
resource "authwise_issuer_domain_binding" "partners" { issuer_id = authwise_issuer.partners.issuer_id domain_id = authwise_domain.login.domain_id path = "/partners"}A path is one or more segments, each starting with /, with no trailing
slash and no query or fragment, such as /partners or /partners/eu. The
root is the empty path, not /. A path whose first segment Authwise
serves on every host is reserved and refused with issuer path reserved:
/.well-known /authorize /oauth /userinfo /api /_ui /assets /account /login/logout /recover-password /health /saml /recovery /magic-link/forgot-password /uiassets /adminA path no issuer holds doesn’t fall back to the issuer at the root. A
request for the bare path, such as https://login.example.com/partners,
is redirected to the path with a trailing slash.
Issuers that share a hostname share its browser cookies. A sign-in at one doesn’t sign the person in at the other, but signing out at one issuer ends the browser’s session at the other, which then signs in again.
The same path rules apply to a native domain, so two issuers can share an Authwise host the same way.
Move an issuer to another hostname
Section titled “Move an issuer to another hostname”An issuer isn’t moved; it is bound to the new hostname beside the old one, and the old binding is removed once nothing uses it.
-
Bind the issuer to the new domain, as in step 5 of Add a domain. The old binding keeps answering with its own
iss. -
Move relying parties to the new issuer URL, one at a time.
-
Choose the new binding as the host mailed links use. See Choose the host mailed links use.
-
Remove the old binding. Sign-ins at its URL stop at once.
In the console, open the issuer’s Hosts tab and click Remove on the host. With
awctl:Terminal window awctl identity issuer-domain-bindings delete BINDING_ID --issuer-id ISSUER_IDReplace
BINDING_IDwith the binding’s identifier (idb-…), which the Hosts tab andissuers describeshow. With Terraform, remove theauthwise_issuer_domain_bindingresource.
A binding can’t be edited. To change its domain or path, remove it and add
another; in Terraform, changing domain_id or path replaces the binding.
Removing an issuer’s last binding is allowed. The issuer then answers nowhere until you bind it again; the console’s Hosts tab says This issuer answers nowhere.
Choose the host mailed links use
Section titled “Choose the host mailed links use”When Authwise mails a link without a request in hand, such as an invitation’s accept link, a password reset, or an address verification, it builds the link on one of the issuer’s bindings: the issuer’s preferred binding, or its first binding when none is chosen. If your applications sign in at the custom hostname, choose that binding, so the person who follows the link lands where the application looks.
In the console, open the issuer’s Hosts tab and click Use for mailed links on the host. The chosen host is marked mailed links, and the issuer’s Configuration page shows its URL under Mailed links use.
With awctl, name the binding by its hostname or its identifier:
awctl identity issuers update ISSUER_ID --preferred-binding login.example.comPass --preferred-binding "" to go back to the first binding.
With Terraform, use authwise_issuer_preferred_binding, as in
With Terraform and Cloudflare. The
issuer’s preferred_binding_id attribute reads the choice back.
A preferred binding on a custom domain that isn’t Active when a link is built is skipped, and the link uses the first binding that answers. Removing the preferred binding sets the issuer back to its first binding.
The issuer’s domain fields
Section titled “The issuer’s domain fields”An issuer has no hostname or path of its own; it answers through its
bindings. Three read-only fields on the issuer still show a host, for
tools that render the issuer’s URL without a request in hand: domain_name
(the hostname), domain_id, and path. They follow the issuer’s first
binding, not the preferred one. When the first binding is removed, they
move to the oldest binding left, and they are empty on an issuer with no
binding. Writing a different value to them is refused.
On create, domain_id and path are an optional shortcut: they make the
issuer’s first binding in the same step. An issuer can also be created with
no domain and bound later. In Terraform, authwise_issuer.domain_id and
path are deprecated for authwise_issuer_domain_binding, and the issuer’s
bindings attribute lists where it answers now.
preferred_domain_id is deprecated for preferred_binding_id. Identity
server 1.84 still accepts it and resolves it to the issuer’s binding on
that domain.
Passkeys
Section titled “Passkeys”A passkey is bound to the hostname it was enrolled at. Passkeys enrolled at
example.id.authwise.com don’t work at login.example.com, and users who
sign in there must enrol a new passkey. To avoid that, bind the issuer to
the custom domain before you roll out passkeys and send users to the
custom domain from the start.
States
Section titled “States”The console shows the domain’s state in words; awctl and Terraform show
the state value, such as PROVISIONING. The console and awctl word the
states differently, so match them by the state column below. A native
domain has no state.
| Console | state | Meaning | What to do |
|---|---|---|---|
| Waiting for DNS | PENDING_DNS | The challenge record doesn’t resolve yet. | Create it, DNS-only. A domain that never verifies lapses, and its hostname is freed after about a week. |
| Issuing certificate | VERIFYING | The certificate authority found the challenge record and is issuing the certificate. | Wait. |
| Activating | PROVISIONING | The certificate is issued and attached, and the hostname routes to its bound issuers. | Create the traffic record now. The domain stays Activating until Authwise finds it in public DNS. |
| Active | ACTIVE | The hostname serves its bound issuers with its own certificate, and the traffic record resolves. | Nothing. |
| Degraded | DEGRADED | The hostname still serves, but a record is missing and the certificate won’t renew. | Restore the record the console names. Tenant administrators get mail when the domain becomes Degraded, and again 14 and 7 days before the certificate expires. |
| Failed | FAILED | Issuance stopped. | Fix the cause, below. |
| Removing | DELETING | The domain is being removed. | Wait. The hostname is released when removal finishes. |
When a domain is Failed or Degraded, the console names the cause
and the record it concerns (failure_code and failure_record in
Terraform):
| Cause | failure_code | What to do |
|---|---|---|
| A record is missing | DNS_NOT_FOUND | Create the named record. |
| A CAA record excludes the certificate authority | CAA | Add CAA records that allow pki.goog and letsencrypt.org on the hostname or the zone, or remove the CAA records. |
| A record has the wrong value, or is proxied | CONFIG | Correct the value, and set the record to DNS-only. |
| The certificate authority’s rate limit | RATE_LIMITED | Wait. Authwise retries. |
| The hostname doesn’t answer as Authwise | PROBE_FAILED | Point the traffic record at the value Authwise gave you. |
| An error on Authwise’s side | PROVIDER_ERROR | Contact support if it persists. |
Remove a domain
Section titled “Remove a domain”A domain can’t be deleted while any issuer is bound to it. The refusal
has the reason DOMAIN_IN_USE and names the issuers; the console says
which issuer the hostname still answers for. Remove the bindings first, as
in step 4 of Move an issuer to another hostname.
To stop serving a hostname you own, delete its traffic record first, then delete the domain:
- In the console, open Domains, choose the hostname, and click Delete.
- With
awctl, runawctl identity domains delete DOMAIN_ID. It asks for confirmation;--yesskips the prompt. - With Terraform, remove the resource. Set each binding’s
domain_idfrom the domain resource, as in the examples above, and a destroy removes the bindings first. The destroy waits until Authwise has released the hostname.
Removal finishes when Authwise has removed the certificate. Until then the
domain shows Removing (DELETING) and the hostname can’t be claimed
again. After that, delete the challenge record, and remove the domain’s
redirect URI from each identity provider.
Deleting an issuer removes its bindings; its domains stay. One exception
remains from earlier releases: an issuer that still holds a custom domain
added to it before identity server 1.84, including one that is still being
removed, can’t be deleted; the refusal has the reason
ISSUER_HAS_DOMAINS. Remove that domain first.
Upgrading from an earlier release
Section titled “Upgrading from an earlier release”Before identity server 1.84, a hostname of your own was added to an issuer, and one issuer could answer at a custom hostname only at its root. The upgrade turns every issuer’s Authwise host and every custom hostname into a binding, so nothing changes for sign-ins and nothing moves by hand. Where two issuers sat at one hostname and path, the older one is bound; the other never served there.
- Terraform. On
authwise_domain, replaceissuer_id = …withcustom = true, and import the binding the upgrade made instead of creating it; creating it again is refused withBINDING_TAKEN. Never let Terraform destroy and recreate a custom domain to migrate it: that deletes its certificate and releases the hostname. See Upgrading to 0.32 in the provider’s reference. awctl.domains create --issuer ISSUER_IDis deprecated for--customfollowed byissuer-domain-bindings create. It still works in this release, and prints the two commands that replace it.issuers update --preferred-domainis deprecated for--preferred-binding.- Console. Custom hostnames moved from the issuer’s Domains tab to the tenant’s Domains page, and the issuer’s Hosts tab replaces the mailed-links select.
Putting your own load balancer or CDN in front
Section titled “Putting your own load balancer or CDN in front”Authwise doesn’t support a load balancer, CDN, or proxy of yours in front of an issuer. The issuer must see the hostname the browser used, because that hostname is the issuer URL in every token and the passkey binding. A proxy in front of it also carries sign-in requests and tokens through infrastructure that Authwise can’t secure or account for. Use DNS-only records that point at Authwise.