Skip to content

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.com carry iss = https://login.example.com.
  • The Authwise host keeps working. example.id.authwise.com keeps answering with its own iss, 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.com through Google, Microsoft, Okta, or another identity provider returns to a redirect URI at login.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.
  • 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, awctl 0.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 as login.example.com. If it must be the apex, your DNS provider’s CNAME flattening (Cloudflare calls it that; others call it ALIAS or ANAME) 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.
ResourceWhat it isScope
DomainA 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
BindingWhere 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.

These four rules prevent every outage this feature can cause:

  1. 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.
  2. 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.
  3. 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.
  4. 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.

To serve an issuer at your own hostname, follow these steps.

  1. 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 --custom

    With Terraform:

    resource "authwise_domain" "login" {
    custom = true
    hostname = "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 with HOSTNAME_IS_ISSUER; bind the issuer to that native domain instead. An installation without a domain controller refuses to add a custom domain, with the reason DOMAINS_UNAVAILABLE.

  2. Read the two DNS records. They appear within about thirty seconds:

    PurposeNameTypeValue
    challenge_acme-challenge.login.example.comCNAMEA value ending in .authorize.certificatemanager.goog
    trafficlogin.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, create prints them. To print them again, run:

    Terminal window
    awctl identity domains get DOMAIN_ID

    Replace DOMAIN_ID with the domain’s identifier (d-…), the last segment of the name that create prints. To find it later, list the tenant’s domains; a hostname of your own shows as custom with its state, and an Authwise host as native:

    Terminal window
    awctl identity domains list
    ID HOSTNAME KIND STATE ISSUER_ID PRODUCT
    d-g3mxasgay3gi awctl69-check.kit-probe.example custom PENDING_DNS
    d-g3mxasgay3gx awctl69chk.id.preview.authwise.com native

    Add --json or --yaml for the whole resource. In Terraform the records are the dns_records attribute and the edge name is traffic_target.

  3. Create the challenge record at your DNS provider, DNS-only.

  4. 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-return

    Replace HOSTNAME with the domain’s hostname, such as login.example.com. For an issuer bound below a path, put the path before /api, such as https://login.example.com/partners/api/v1/authorize/user-core/provider-return.

    Each binding is its own issuer, so a sign-in at login.example.com sends 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, answers redirect_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’s create and get print 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/metadata

    Replace PROVIDER_ID with 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.

  5. 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.com

    Replace ISSUER_ID with the issuer’s identifier (i-…). --domain takes the hostname; --domain-id takes the domain’s identifier instead. --path is 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_id
    domain_id = authwise_domain.login.domain_id
    }

    The binding’s url attribute 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 with product set), with DOMAIN_NOT_BINDABLE.

    To see where an issuer answers, open its Hosts tab in the console, or run:

    Terminal window
    awctl identity issuers describe ISSUER_ID
    NAME DOMAIN_NAME PREFERRED_BINDING_ID
    tenants/t-g3mxi3jjxzb4/issuers/i-g3mxca1sifpt awctl69chk.id.preview.authwise.com
    bindings:
    ID ISS ROUTABLE PREFERRED
    idb-g3mxca1sifpz https://awctl69chk.id.preview.authwise.com yes yes
    idb-g3mxca1sifq2 https://awctl69-check.kit-probe.example not yet no
    Client ID metadata documents: off

    ROUTABLE is not yet on a custom domain whose certificate isn’t live.

  6. 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. With awctl, run the get command from step 2 and read state:

    name tenants/TENANT_ID/domains/DOMAIN_ID
    hostname login.example.com
    kind custom
    state PROVISIONING
    traffic target EDGE_NAME
    bound issuers:
    ISSUER BINDING ISS
    ISSUER_ID idb-g2abcdefgh02 https://login.example.com
    NAME TYPE VALUE PURPOSE
    _acme-challenge.login.example.com CNAME CHALLENGE_ID.2.authorize.certificatemanager.goog challenge
    login.example.com CNAME EDGE_NAME traffic
    Add 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_ID stands for the identifier Authwise generates for the domain’s challenge record, and EDGE_NAME for the installation’s edge name.

  7. 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. With awctl, add --wait to the create in 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 reaches PROVISIONING, 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.

    --wait exits zero when the domain is ACTIVE, and non-zero if the domain ends FAILED, DEGRADED, or DELETING, or after 30 minutes (change that with --timeout).

  8. Optional: move relying parties to the new issuer URL, https://login.example.com. Each one picks up the new iss from the new discovery document.

  9. Optional: make the new hostname the one mailed links carry. See Choose the host mailed links use.

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.

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:

Terminal window
awctl identity issuer-domain-bindings create --issuer-id PARTNER_ISSUER_ID --domain login.example.com --path /partners

With 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 /admin

A 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.

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.

  1. Bind the issuer to the new domain, as in step 5 of Add a domain. The old binding keeps answering with its own iss.

  2. Move relying parties to the new issuer URL, one at a time.

  3. Choose the new binding as the host mailed links use. See Choose the host mailed links use.

  4. 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_ID

    Replace BINDING_ID with the binding’s identifier (idb-…), which the Hosts tab and issuers describe show. With Terraform, remove the authwise_issuer_domain_binding resource.

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.

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:

Terminal window
awctl identity issuers update ISSUER_ID --preferred-binding login.example.com

Pass --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.

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.

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.

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.

ConsolestateMeaningWhat to do
Waiting for DNSPENDING_DNSThe 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 certificateVERIFYINGThe certificate authority found the challenge record and is issuing the certificate.Wait.
ActivatingPROVISIONINGThe 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.
ActiveACTIVEThe hostname serves its bound issuers with its own certificate, and the traffic record resolves.Nothing.
DegradedDEGRADEDThe 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.
FailedFAILEDIssuance stopped.Fix the cause, below.
RemovingDELETINGThe 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):

Causefailure_codeWhat to do
A record is missingDNS_NOT_FOUNDCreate the named record.
A CAA record excludes the certificate authorityCAAAdd 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 proxiedCONFIGCorrect the value, and set the record to DNS-only.
The certificate authority’s rate limitRATE_LIMITEDWait. Authwise retries.
The hostname doesn’t answer as AuthwisePROBE_FAILEDPoint the traffic record at the value Authwise gave you.
An error on Authwise’s sidePROVIDER_ERRORContact support if it persists.

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, run awctl identity domains delete DOMAIN_ID. It asks for confirmation; --yes skips the prompt.
  • With Terraform, remove the resource. Set each binding’s domain_id from 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.

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, replace issuer_id = … with custom = true, and import the binding the upgrade made instead of creating it; creating it again is refused with BINDING_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_ID is deprecated for --custom followed by issuer-domain-bindings create. It still works in this release, and prints the two commands that replace it. issuers update --preferred-domain is 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.