Guides · Shipping & operations
Custom domains
Bind your own domains to a project’s HTTPS API and file buckets with automated TLS certificates and zero-downtime cutover.
What you’ll build#
This guide binds your own domain to a project’s HTTPS API (api.example.com) and to your cluster’s private and public file buckets (files.example.com and cdn.example-files.com). Napalm issues and renews every TLS certificate automatically and serves both your custom API domain and <label>.napalmdata.com during cutover so live clients never drop requests.
Domain commands require an organization manager role or an org token with manage scope, plus access to your domain’s DNS records. A custom API domain also needs a project whose cluster has a public endpoint. The commands below take the project’s name, notes.
Custom API hostname
Queries, live streams, sign-in, MCP and A2A all answer on your own HTTPS domain.
Delegated TLS renewal
A delegated ACME CNAME lets Napalm issue and renew certificates without DNS credentials.
Isolated file domains
Private signed links and permanent public asset URLs stream straight from object storage.
API domains vs file domains#
Napalm separates your project API hostname from your file storage hostnames because each serves a distinct data path. Queries, live subscriptions, sign-in and agent protocols terminate on your cluster’s stateless engines, while file uploads and downloads stream directly between clients and object storage.
| Target | What the domain serves | DNS records | TLS and default hostname |
|---|---|---|---|
api | Project API: /query, /subscribe (SSE and WebSockets), /sign-in, /uploads, /ask, /openapi.json, /mcp and /, plus branches at https:/. | DNS recordsTwo CNAME records: traffic CNAME to <label>.napalmdata.com and _acme-challenge CNAME to _acme-challenge.<label>.api.napalmdata.com. | TLS and default hostnameDNS-01 TLS issued and renewed automatically. <label>.napalmdata.com stays on the same certificate and keeps serving. |
files | Private file bucket: presigned file_url and file_download_url links for private ext::files::File records (file_is_public = false). | DNS recordsOne CNAME record pointing at the private bucket target shown in napalm domains ls notes or the console. | TLS and default hostnameManaged TLS issued once the CNAME resolves. Signed download links switch to your domain automatically. |
public | Public file bucket: permanent unsigned file_url and file_download_url links for public ext::files::File records (file_is_public = true). | DNS recordsOne CNAME record pointing at the public bucket target shown in napalm domains ls notes or the console. | TLS and default hostnameManaged TLS issued once the CNAME resolves. Use a dedicated asset domain so uploads never share cookies with your app. |
Attach a custom API domain#
Register the custom API domain first with --no-check so Napalm reserves the hostname and prints the two CNAME targets. If your cluster has not claimed a <label>.napalmdata.com subdomain yet, pass --label <label> when adding your first API domain (for example napalm domains add notes api api.example.com --label notes --no-check).
# Register the custom API domain (--label claims <label>.napalmdata.com on first setup)napalm domains add notes api api.example.com --no-check # After adding both CNAME records at your DNS provider, verify DNS and issue TLSnapalm domains check notesIn the web console, open your project, select the Access and agents tab, find Custom domains and enter api.example.com. Add both CNAME records at your DNS provider, then click Check domain (or run napalm domains check notes).
| Type | Name | Target | Proxy and TTL |
|---|---|---|---|
CNAME | api.example.com | Target<label>.napalmdata.com | Proxy and TTLDNS only (HTTP proxy off), 300 s TTL |
CNAME | _acme-challenge.api.example.com | Target_acme-challenge.<label>.api.napalmdata.com | Proxy and TTLDNS only (HTTP proxy off), 300 s TTL |
Four DNS details keep initial verification, streaming connections and background renewals trouble-free.
- Turn off DNS HTTP proxying
- Keep proxy and CDN interception off (such as DNS-only gray-cloud mode in Cloudflare) on both
CNAMErecords. Client connections must reach your cluster’s engines directly for TLS termination, HTTP/2, SSE streaming and long-lived/subscribeWebSockets, and DNS resolvers must follow_acme-challengestraight to the validationTXTrecord. - Keep _acme-challenge in place
- Leave the
_acme-challengeCNAMErecord permanently in DNS. Napalm renews certificates automatically 30 days before expiry through that delegated record without storing credentials for your DNS zone. If either record is missing at renewal, the domain goes back to waiting for its records and the project advertises<label>.napalmdata.comagain. A nightly check attaches the domain once both records resolve. - Apex domains and CNAME flattening
- Use a subdomain such as
api.example.comwhenever possible. If your DNS provider flattensCNAME,ALIASorANAMErecords intoAandAAAAanswers, Napalm accepts matching cluster IP answers on the traffic record while_acme-challengestays a standardCNAME. - CAA records
- If your parent zone publishes
CAArecords, allowletsencrypt.org(0 issue "letsencrypt.org") so Let’s Encrypt can issue and renew certificates for the hostname.
Update sign-in, CORS and agents#
Once api.example.com reaches serving, your cluster’s TLS certificate covers both api.example.com and <label>.napalmdata.com. Deployed mobile apps, open browser tabs and backend workers still calling https:/ keep working with zero downtime. At the same time, GET /, GET /sign-in, /openapi.json, /mcp and / advertise https://api.example.com (and https:/ on preview branches).
- External OAuth callbacks
- Before switching client traffic over, add
https:/to Google, GitHub, Microsoft, Discord, Slack and any custom OIDC provider alongside your existing/ api.example.com/ sign-in/ callback https:/entry. Keeping both callback URLs registered lets in-flight and older app builds complete OAuth sign-in cleanly./ <label>.napalmdata.com/ sign-in/ callback - allowedOrigins vs API domain
allowedOriginslists up to 32 browser origins where your frontend web app runs (for examplehttps://app.example.com), whereasapi.example.comis the API address passed tonew NapalmClient('https:/. Only add an origin to/ api.example.com') allowedOriginswhen browser pages on that origin call Napalm.- Post-login redirect URLs
napalm sign-in set --redirectlists the frontend pages or mobile app schemes where Napalm sends users after sign-in completes (such ashttps:/), separate from the/ app.example.com/ signed-in /sign-in/callbackURL registered at OAuth providers.- MCP and A2A clients
napalm mcp notespicks up the new advertised endpoint automatically through the Control API. Update any hard-coded/mcpor/URLs in external agent configurations at your own pace..well-known/ agent-card.json
# Allow browser CORS requests from your frontend web app originnapalm endpoint notes --allow-origin https://app.example.com # Allow post-login redirects back to your frontend callback pagenapalm sign-in set notes --redirect https://app.example.com/signed-in # Inspect the advertised API URL and active sign-in settingsnapalm endpoint notesnapalm sign-in show notesPoint your application’s SDK and SignIn client at https://api.example.com in your next deploy.
import { NapalmClient, SignIn, webStore } from 'napalm-client' const signIn = new SignIn('https://api.example.com', { redirectUrl: 'https://app.example.com/signed-in', store: webStore(),}) export const napalm = new NapalmClient('https://api.example.com', { token: signIn.token,})Attach custom file domains#
You can also bind custom domains to your cluster’s public (public) and private (files) object storage buckets from the CLI or under Custom file domains on the cluster’s page in the console. Each file bucket domain uses a single CNAME record pointing at the bucket target printed by napalm domains ls.
# Provision file storage if the cluster has no file buckets yetnapalm storage enable notes files --label notes # Register custom domains for public and private file bucketsnapalm domains add notes public cdn.example-files.com --no-checknapalm domains add notes files files.example.com --no-check # Inspect the bucket CNAME targets, then verify once DNS records resolvenapalm domains ls notesnapalm domains check notesOnce a bucket domain reaches serving, selecting file_url or file_download_url on Ready file records returns URLs on your custom domain automatically without re-uploading objects. Public files return permanent https:/ URLs, and private files return presigned https:/ URLs signed once in each 1-hour window and valid for 6 hours. See Files & object storage for schema declarations and upload verification.
Move or retire a domain safely#
Before retiring a custom API domain, deploy client updates pointing back to https:/ (or attach and cut over to a replacement custom API domain first). Retiring the domain with napalm domains remove or POST / reverts the project’s advertised endpoint URL to https:/ right away. The cluster’s certificate drops the retired hostname at its next renewal.
# Retire the custom API domain and revert the advertised URL to <label>.napalmdata.comnapalm domains remove notes api.example.comA custom hostname can belong to only one active or pending project or bucket across Napalm (409 host_taken otherwise). To move a hostname to another project, retire the domain on the original project first, update the CNAME records to the destination cluster’s <label> targets and run napalm domains add on the destination cluster.
Check your custom domains#
Confirm every domain is serving
Run
napalm domains ls notesand verify each API and file bucket domain showsservingwith no pending DNS warning.Verify TLS and advertised endpoint metadata
Run the
curlchecks below to confirm TLS terminates cleanly on your custom API domain and/openapi.jsonand/sign-inadvertisehttps://api.example.com.Exercise sign-in, live streams and file links
Sign in from your production frontend origin, confirm an OAuth callback completes without error and verify a live subscription and file download succeed over your custom domains.
# Confirm every API and file bucket domain reports servingnapalm domains ls notes # Verify TLS termination and check the advertised OpenAPI and sign-in metadatacurl -fsSI https://api.example.com/openapi.jsoncurl -fsS https://api.example.com/sign-inTroubleshooting#
| Symptom | Cause | Fix |
|---|---|---|
Domain stays in Waiting for the DNS record | One or both CNAME records have not propagated yet, or DNS HTTP proxying rewrites the answer. | FixCheck dig CNAME api.example.com +short and dig CNAME _acme-challenge.api.example.com +short, disable HTTP proxying and run napalm domains check notes. |
| Certificate validation times out | _acme-challenge is missing or proxied, or a parent CAA record blocks Let’s Encrypt. | FixVerify _acme-challenge points at _acme-challenge.<label>.api.napalmdata.com unproxied and allow 0 issue "letsencrypt.org" in your zone’s CAA records, then re-run napalm domains check notes. |
409 host_taken when adding a domain | The hostname is already bound to or awaiting verification on another project or file bucket. | FixRetire the domain on the other project with napalm domains remove before adding the hostname to this project’s cluster. |
400 invalid_request when adding a domain | The hostname sits under napalmdata.com or napalmcontent.com, or the project’s cluster has a private endpoint. | FixUse a hostname in a zone you control. Give the cluster a public endpoint before adding a custom API domain. |
OAuth login fails with redirect_uri_mismatch | The OAuth provider only lists the <label>.napalmdata.com callback URL. | FixAdd https:/ to the provider’s authorized redirect URIs alongside https:/. |
Browser requests fail with 403 forbidden or CORS errors | Your frontend web origin is missing from allowedOrigins. | FixRun napalm endpoint <project> --allow-origin https:/ (allowedOrigins lists your frontend app’s origin rather than api.example.com). |