Custom domains
Attach a customer-owned domain to Apoxy's default Gateway with zero-downtime TLS provisioning.
A DomainRecord binds a hostname you own (e.g., api.example.com) to a Gateway, Proxy,
TunnelNode, VPCService, or EdgeFunction on Apoxy. Apoxy handles DNS delegation, ACME certificate
issuance, and renewal.
How it works
For customer-owned hostnames, Apoxy uses a CNAME model. You keep authority over your zone;
Apoxy only needs you to point the hostname at a zone we control (cname.apoxy.net) so we can
serve traffic and issue certificates on your behalf.
Each hostname belongs to one project. The first project that proves control of the hostname
gets it, and a different project then gets Ready=False with reason HostnameClaimed. A
hostname inside a zone that a different project manages with a DomainZone is also refused.
Apoxy publishes the address records behind <hostname>.cname.apoxy.net only after your
project has the hostname, so the target of your CNAME resolves after the first ownership
proof, not when you apply the DomainRecord.
Minimal setup
apiVersion: core.apoxy.dev/v1alpha3
kind: DomainRecord
spec:
name: api.example.com
tls: {}
target:
ref:
group: gateway.apoxy.dev
kind: Gateway
name: defaultOmit metadata.name. Apoxy generates the resource name from spec.name and the target type.
Apply the DomainRecord, then create the CNAME at your registrar:
api.example.com. CNAME api.example.com.cname.apoxy.net.Inspect the generated record and target status by filtering on the hostname:
apoxy domain list \
--field-selector spec.name=api.example.com \
-o yamlTunnel-backed targets
Pointing target.ref at a TunnelNode (group core.apoxy.dev) or a VPCService (group
vpc.apoxy.dev) routes the hostname through the default Gateway to endpoints behind your
tunnel agents - no explicit HTTPRoute needed. The controller wires the route automatically
and keeps the TargetReady condition on the DomainRecord in sync with the target's
endpoint health.
Once the CNAME propagates, Apoxy issues a TLS certificate using the ACME HTTP-01 challenge (Let's Encrypt / Google Trust Services). This takes roughly 30–60 seconds.
Zero-downtime migration (pre-issuance)
The default HTTP-01 flow has a side effect: the certificate is only issued after you flip
your main CNAME. Until status.conditions.TLSReady=True, browsers hitting the new endpoint see
a certificate error - typically a 30–60 second window.
To eliminate that window, delegate the ACME validation to Apoxy before you cut over:
Apply the DomainRecord
Same as above.
Add the ACME challenge delegation CNAME
At your registrar, create an additional CNAME:
_acme-challenge.api.example.com. CNAME _acme-challenge.api.example.com.cname.apoxy.net.The target must be _acme-challenge.<your-full-domain>.cname.apoxy.net. - include every
label of your hostname verbatim, including the TLD. Dropping the TLD or a mid-label is the
most common mistake and the delegation check will never pass.
| Hostname | Correct target | Common wrong target |
|---|---|---|
api.example.com | _acme-challenge.api.example.com.cname.apoxy.net. | _acme-challenge.api.example.cname.apoxy.net. (missing .com) |
app.example.co.uk | _acme-challenge.app.example.co.uk.cname.apoxy.net. | _acme-challenge.app.example.co.cname.apoxy.net. (missing .uk) |
The filtered record prints the exact target in the ACMEChallengeReady condition message.
This tells the ACME CA to look up the validation TXT record inside our zone, so we can prove domain ownership via DNS-01 without any traffic flowing through Apoxy yet.
Wait for the certificate
Apoxy detects the delegation and pre-issues the certificate. Watch the conditions:
apoxy domain list \
--field-selector spec.name=api.example.com \
-o yamlYou should see:
items:
- status:
conditions:
- type: ACMEChallengeReady
status: "True"
reason: ACMEChallengeConfigured
- type: TLSReady
status: "True"
reason: CertificateIssued
- type: CNAMEConfigured
status: "False"
reason: CNAMENotConfiguredCNAMEConfigured=False is expected before cutover. TLSReady=True lands first, so the certificate
is already on the gateway when you switch traffic.
Flip the main CNAME
Now change your main record at your registrar:
api.example.com. CNAME api.example.com.cname.apoxy.net.The next DNS resolution hits Apoxy. Our gateway serves the already-issued certificate from the first request - no cert error, no refresh loop. For a hostname that receives steady traffic, the gateway renews its copy of the certificate in the background, so renewal does not add latency to client handshakes.
Keep the delegation CNAME
Leave _acme-challenge.api.example.com pointing at our zone. Renewal then uses the same DNS-01
path and does not need HTTP requests to reach Apoxy. Without the delegation, renewal uses
HTTP-01 while the main CNAME points to Apoxy. See What renewal needs.
Zero-downtime migration - HTTP-only (no TLS)
TLS is the default: a DomainRecord that targets a Gateway, Proxy, TunnelNode, VPCService,
EdgeFunction, or another DomainRecord gets a managed certificate even if you omit the tls block
entirely. To serve a hostname over plain HTTP instead, ask for it explicitly:
spec:
tls:
disabled: truedisabled: true and certificateAuthority are mutually exclusive - naming a CA while
switching issuance off is rejected at admission rather than silently honored one way.
disabled governs whether Apoxy provisions a certificate for a domain that does not have
one. It is not a way to remove a certificate you already have:
- No certificate is provisioned, and the domain settles at
Activeonce ownership is proven rather than waiting on an issuance that will never happen. - A domain that already holds a certificate keeps it, keeps serving it, and keeps renewing it. Letting a certificate that is still being served lapse would break HTTPS on a cliff, so renewal deliberately continues.
- Ownership is unaffected. A domain verified by an existing certificate stays verified and routable - disabling TLS never detaches a live hostname.
- Clearing the field starts issuance on the next reconcile.
To stop serving a certificate entirely, delete the DomainRecord.
Until a certificate exists, HTTPS requests for the hostname fail the TLS handshake; plain HTTP serves normally.
With TLS off there is no ACME certificate whose issuance could double as proof of ownership. Apoxy instead accepts an explicit ownership challenge at a dedicated label:
_apoxy-challenge.api.example.com. CNAME _apoxy-verify.cname.apoxy.net.The target is a single fixed string - no FQDN embedding, no per-domain token. Copy it verbatim.
Once the challenge resolves, the controller marks the DomainRecord with
OwnershipVerified=True and admits the hostname to the data plane. From that point, the
moment you flip your main CNAME the gateway starts serving traffic for it - the same
zero-downtime effect as the TLS flow, without needing a certificate.
TLS customers get OwnershipVerified=True as soon as their main CNAME resolves to our zone -
a CNAME pointing at us proves DNS control on its own, whether or not a certificate has been
issued yet. An issued, unexpired certificate also holds ownership on its own: ACME proved you
controlled the domain when it was issued, and that proof stands until the certificate expires.
A DNS blip - ours or your provider's - can therefore never de-verify a domain that holds a
valid certificate. Renewal requires a fresh DNS proof, so a domain you genuinely move away
detaches when its certificate lapses. Setting _apoxy-challenge in
addition is optional for TLS - the _acme-challenge delegation already covers both the
pre-issued cert and ownership.
You can leave the _apoxy-challenge delegation in place permanently; it's idempotent and
doesn't need to be touched across renewals or cutovers.
Certificate status and renewal
status.certificate describes the certificate that serves the hostname:
status:
certificate:
commonName: api.example.com
dnsNames:
- api.example.com
issuer: WR1
certificateAuthority: Google Trust Services
serialNumber: 7b3e1c9a4f0d2e5a8c6b1d0e9f2a4c38
notBefore: "2026-11-01T10:12:00Z"
notAfter: "2027-01-30T10:11:59Z"
renewalTime: "2026-12-31T10:40:13Z"commonName- the common name of the certificate subject. It can be empty: some CAs leave it out.dnsNames- the DNS names in the subject alternative name (SAN) extension of the certificate. A wildcard certificate shows*.example.com.issuer- the common name of the CA certificate that signed it.certificateAuthority- the organization of that CA.serialNumber- the serial number in lowercase hex.notBefore,notAfter- the validity of the certificate.renewalTime- when Apoxy starts to renew it. See When renewal starts.lastFailureTime,lastFailureMessage- the failure of the last renewal attempt. They go away when the next attempt starts or a new certificate replaces the old one.
The field is empty until a certificate exists. The status shows a renewed certificate within 5 minutes after Apoxy stores it.
When renewal starts
Apoxy starts to renew a certificate two thirds of the way through its lifetime, plus a fixed spread of up to one hour for each hostname. The CA sets the lifetime, so the renewal time follows it:
- A 90-day certificate renews at about day 60, 30 days before
notAfter. - A 45-day certificate renews at about day 30, 15 days before
notAfter.
status.certificate.renewalTime shows the exact time for your certificate.
What renewal needs
Renewal proves control of the hostname again, the same way as the first certificate.
Hostname in a zone that you manage with a DomainZone. The zone stays delegated to Apoxy.
When the delegation has no Apoxy nameserver, the DomainZone shows DelegationPresent=False,
renewal attempts fail, and lastFailureTime and lastFailureMessage show the failure. After
7 days with no Apoxy nameserver, the zone goes to Error with the reason DelegationLost:
Apoxy stops serving the zone, the record shows Ready=False, and renewal stops. Set the
nameservers again and recheck the zone, as
Zone control shows.
Customer-owned hostname (CNAME model). Your project keeps the hostname, and one of its two CNAMEs stays in place:
_acme-challengeCNAME - renewal uses DNS-01. The record hasACMEChallengeReady=True.- Main CNAME - with no
_acme-challengeCNAME, renewal uses HTTP-01, as for the first certificate. The record hasCNAMEConfigured=True, and requests forhttp://<hostname>/.well-known/acme-challenge/must reach Apoxy.
With tls.disabled: true, the record does not show ACMEChallengeReady, but renewal works the
same way. Without either CNAME, Apoxy does not start a renewal: renewalTime stays in the past
and no new failure shows. Add one of the CNAMEs again before notAfter, and renewal starts on
the next check.
While Apoxy serves the hostname, a certificate that is not renewed keeps serving until
notAfter. After that, the hostname has no valid certificate and TLSReady is not True
until Apoxy issues a new one.
Failed renewal
- Apoxy tries again 6 hours after a failed attempt.
status.certificate.lastFailureTimeandlastFailureMessageshow the failure of the last attempt.- The certificate in use keeps serving until
notAfter. For a 90-day certificate, that gives you about 30 days to fix the cause.
Other rules
tls.disabled: truedoes not stop the renewal of a certificate the hostname already has.- Apoxy renews a certificate only while a
DomainRecordfor its hostname exists. Delete the last one and renewal stops; the stored certificate expires atnotAfter. - A hostname that a wildcard certificate serves: when a
DomainRecordfor the wildcard name exists, that record renews the wildcard certificate. When none exists, the hostname gets a certificate of its own when the wildcard certificate is due.
Lifecycle phases
status.phase is the single answer to "where is my domain". Conditions (below) are the
observation log underneath it: each records one fact and when it last changed, which is what
explains why the record is in a given phase.
| Phase | Meaning | Routable |
|---|---|---|
Pending | No ownership proof observed yet: no main CNAME, no challenge delegation. Or a different project holds the hostname (HostnameClaimed). | No |
Issuing | Ownership proven, certificate being minted (first issuance, or re-issuance after an expiry). Routable so the HTTP-01 challenge can be answered. | Yes |
Active | Everything on Apoxy's side is done: ownership proven, certificate stored (for TLS records). Traffic serves the moment it arrives. | Yes |
Detached | Every ownership proof is gone after the record was live, or a different project holds the hostname. Releases the hostname: a different project can use it 25 hours later. | No |
Phase transitions require affirmative observations: if we cannot reach a resolver or the certificate store, or get an answer we have reason to distrust, the phase holds rather than regressing. The phase describes Apoxy's side only. Two things it deliberately excludes are reported by conditions instead:
- Cutover. A pre-issued record whose main CNAME has not been flipped yet is
ActivewithCNAMEConfigured=False- our side is finished; the remaining step is yours. - Backend health. An
Activerecord with an unhealthy backend staysActiveand serves 502s, reported by theTargetReadycondition.
Records created before phases existed show an empty phase until their next reconcile.
Condition reference
| Condition | Meaning |
|---|---|
OwnershipVerified | True when Apoxy has proof you control this hostname - a valid _apoxy-challenge CNAME, a successful main-CNAME cutover, an issued unexpired certificate, or - for zone-managed records - a verified DomainZone for the zone itself (reason: ZoneOwned). This is the fact behind the routable phases. A hostname is provably yours before your first cert is issued, and a valid cert keeps it yours until expiry even through DNS blips. |
TLSReady | True when Apoxy has a valid certificate for this hostname. Until then, HTTPS does not work and plain HTTP does. Backend health does not change it. Not set when tls.disabled: true and no certificate is stored. |
ACMEChallengeReady | Your _acme-challenge.<fqdn> CNAME points into our managed zone, so we can pre-issue and renew certs via DNS-01. Without it, issuance and renewal use HTTP-01 through the main CNAME. Also absent when tls.disabled: true. |
CNAMEConfigured | Your main CNAME currently resolves to our zone. For CNAME-mode records this is one of the proofs that flips OwnershipVerified (above); on its own it does not decide whether traffic is served. |
TargetReady | The backend (Gateway / Proxy / Tunnel / EdgeFunction) this record points at is healthy. |
Ready | Aggregate: all of the customer-visible setup above is green. Dashboards and CLI show this; the data plane does not key on it. A zone-managed record whose DomainZone is not verified yet has reason: ZoneNotClaimed: Apoxy writes no DNS record of the zone until then, and writes the records within seconds after it. A zone-managed record whose DomainZone is in phase Error has reason: ZoneError: Apoxy writes no DNS record of the zone. A record whose hostname a different project holds, or released less than 25 hours ago, has reason: HostnameClaimed on Ready and on OwnershipVerified: Apoxy writes no DNS record and issues no certificate for it. Its TLSReady is True only when a certificate for the hostname is already stored; the record still serves no traffic. |
How conditions behave when we can't read your DNS
Every condition above that is derived from a DNS lookup - OwnershipVerified,
CNAMEConfigured, ACMEChallengeReady - distinguishes two different negatives:
- Your record is not published. A resolver answered and told us nothing is there. The
condition updates to reflect that. Remove your
_apoxy-challengedelegation andOwnershipVerifiedwill goFalsewith reasonOwnershipNotVerified, which also releases your claim on the hostname. A different project can use the hostname 25 hours after the release. Deleting the last DomainRecord of the hostname in your project releases it too. - We could not reach a resolver. No answer came back at all, so nothing is known. The condition is held at its last observed value rather than retracted, and the status is not rewritten. A DNS outage on our side or a public-resolver blip therefore does not change what your domain reports, and does not interrupt serving.
The practical consequence: a condition that has not changed in a while is not necessarily a
condition we re-confirmed a moment ago. lastTransitionTime records when the value last
changed, not when it was last checked.
Fallback
If you skip the ACME challenge delegation (no _acme-challenge CNAME), Apoxy falls back to
HTTP-01 after you flip
the main CNAME. That still works - we will try to create certificates on the fly and you just
get the standard 30-60s window between cutover and TLSReady=True. Renewal also uses HTTP-01
while the main CNAME points to Apoxy.
Troubleshooting
-
ACMEChallengeReady=Falseafter adding the CNAME - DNS caching. Wait up to the record's TTL at the customer resolver, then re-check withdig CNAME _acme-challenge.api.example.com. -
TLSReady=Falsewith reasonCertificateError- check the status message. Common causes: delegation CNAME points to the wrong target (verify it ends in.<cname-zone-suffix>.exactly using the label-match table above), or the ACME account is rate-limited. -
Want to see what target to use - Filter
apoxy domain list -o yamlwith--field-selector spec.name=<hostname>to see the delegation target in the condition message. -
Fixed a typo in the delegation CNAME but it still shows
False- two DNS caches may hold stale answers until they expire:- The old CNAME value at recursive resolvers - pinned for the TTL you set at your registrar (commonly 300s–3600s).
- The NXDOMAIN for the broken target inside
cname.apoxy.net- cached up to the zone's SOA MINIMUM TTL, 300s (5 minutes).
To minimize this window, drop your registrar's CNAME TTL (e.g. to 60s) before you first publish it, so any typo is easy to correct. If you've already been bitten, there's no shortcut - wait out the longer of the two TTLs, then run the filtered domain list again.
ACMEChallengeReadyshould becomeTrueon the next reconcile (runs every ~30s). -
Ready=Falsewith reasonHostnameClaimed- a different project holds this hostname, or a zone that contains it, or released it less than 25 hours ago. The status message tells which. Use the project that holds it, or delete the DomainRecord there and wait 25 hours. If you control this domain and do not know the other project, contact support. A certificate does not move with the hostname: the new project gets a new certificate. Wait forTLSReady=Truein the new project before you send HTTPS traffic to the hostname. -
<hostname>.cname.apoxy.netdoes not resolve - Apoxy publishes its addresses after the first ownership proof. Resolvers that asked before that cache the NXDOMAIN for up to 300s (5 minutes). -
ACME rate-limit errors - issuance workflows honor the CA's
Retry-Afterheader and sleep in-place instead of thrashing, so a single rate-limited domain will not burn the shared quota. A certificate that was in flight during a rate-limit event will resume automatically once the window clears. Check the filtered domain list;TLSReadybecomesTruewithout further action.