DevelopersCustom domains
Custom domains
Every app can answer on your own domains, such as www.shop.com. By default a domain goes through the Hostwolf edge: you add one DNS record, and the edge gets a TLS certificate for the domain, caches your static files, filters attacks and sends each visitor to your app.
Examples use the hw helper and $API from the quick start, and $APP is the app's uuid.
Add a domain#
In the console#
- Open the app and go to Domains.
- Click Add domain and enter the domain, for example
www.shop.com. - Open DNS records under the domain and add them at your DNS provider. Each has a Copy button. The first one is the TXT record that proves you own the domain (see Prove you own the domain).
- Deploy or restart the app so it answers on the new domain.
The status next to the domain starts at Waiting for verification, moves to Waiting for DNS once the TXT record is found, then to Issuing certificate and Active, usually within minutes of your DNS changes. Check now checks again right away.
With the CLI#
hostwolf apps domains add my-app www.shop.com # prints the TXT record to add first, then the DNS records
hostwolf apps restart my-app
hostwolf apps domains check my-app www.shop.com # looks for the records again now
With the API#
hw -X POST $API/applications/$APP/custom-domains -d '{"domain": "www.shop.com"}' | jq '{status, verification_record, dns_records}'
Prove you own the domain#
A new domain starts as pending_verification. Add this TXT record at your DNS provider before anything else:
| Type | Name | Value |
|---|---|---|
TXT | _hostwolf-challenge.www.shop.com | hostwolf-verify=… (the value is shown for your domain) |
The exact name and value are listed first under DNS records in the console, in verification_record and dns_records of the API, and in the output of hostwolf apps domains add and hostwolf apps domains check. Hostwolf looks for the record again every couple of minutes, and right away when you click Check now, run hostwolf apps domains check, or call GET …/custom-domains/{domain}?refresh=1.
- A domain on the Hostwolf edge is not switched on until the record is found, and a domain that is still unverified after 7 days is removed again. Add the domain once you can edit its DNS.
- A domain that is served directly from your server keeps working without the record, but only a verified domain is reserved for your account.
- If the name is already held by another account that has not verified it, adding it answers
409with the TXT record to publish for your own account. Add that record, then add the domain again. - Domains that were added before verification existed are already verified. Once the record is found the domain is
verifiedandverification_recordisnull.
DNS records#
- One CNAME record (required): point the domain at
edge.app.hostwolf.net. Forwww.shop.comthat isCNAME www.shop.com → edge.app.hostwolf.net. - A second TXT record (optional, only when the list shows one): it lets the edge prepare the domain's certificate before you change the CNAME. Use it to move a live site from another host with no downtime: add the TXT record first, give it a few minutes, then switch the CNAME, so the certificate is ready when traffic moves.
The exact names and values for your domain are listed under DNS records in the console, in the dns_records field of the API, and in the output of hostwolf apps domains add.
Root domains#
A root (apex) domain such as shop.com can only have a CNAME record if your DNS provider supports CNAME flattening at the root, also called ALIAS or ANAME. If it doesn't, add www.shop.com to your app and redirect shop.com to it at your DNS provider. The API marks root domains with "apex": true.
What the edge gives you#
- TLS certificate: issued and renewed for you.
- Caching of static files: images, CSS, JavaScript and fonts are cached at the edge and follow your app's
Cache-Controlheaders. Requests with cookies or anAuthorizationheader are not cached, so pages for signed-in visitors always come from your app. - DDoS protection: attacks are filtered at the edge before they reach your server.
- Nearest city: when the app runs copies in several cities (see Scaling), each visitor is sent to the nearest one.
Limits on a custom domain#
Your domain goes through the Hostwolf edge, which has limits of its own. We measured them on a live app:
- Time to answer: a request must start answering within about two minutes. A 110-second request worked; requests that needed 130 seconds or more ended with a
524error after about 125 seconds. For longer work, answer at once and let the page check back, or stream the response. - Upload size: up to 100 MB per request. A 99 MB upload worked; larger ones are refused (
413or502). For bigger files, let the browser upload straight to file storage with a presigned link. - WebSockets and server-sent events: both work. Two idle WebSockets stayed open for four minutes without any traffic. Open connections end when the app is redeployed or restarted, so clients should reconnect.
The app's generated address (<app>.<server>.app.hostwolf.net) does not go through the edge and has different limits, listed on Deployments.
Purge cache#
After a deploy that changes static files under the same names, purge the cache so the next requests fetch them fresh from your app. You can purge once a minute per domain.
- Console: Purge cache under the domain's DNS records.
- CLI:
hostwolf apps domains purge my-app www.shop.com. - API:
POST /applications/{uuid}/custom-domains/{domain}/purge-cache. It answers202, or429when the domain was purged less than a minute ago.
Files with a version in their name, such as app.3f2a9c.js, never need a purge.
Serve a domain directly#
Proxied by Hostwolf edge is on for every new domain. Turn it off to serve the domain directly from your server:
- The DNS record is an A record to the server's IPv4 address (and an AAAA record when the server has IPv6), not the CNAME.
- The certificate comes from Let's Encrypt on the server.
- There is no edge caching, DDoS protection or nearest-city routing.
hostwolf apps domains edge my-app www.shop.com off # prints the A/AAAA records
hostwolf apps domains add my-app api.shop.com --no-edge
Turning the edge back on gives you the CNAME record again.
Price#
Custom domains on the Hostwolf edge are currently included at no extra charge. The API shows monthly_price for each domain.
API#
| Call | What it does |
|---|---|
GET /applications/{uuid}/custom-domains | The app's domains: {data: [domain]}. Up to 200; per_page (1 to 200) and page read further pages |
POST /applications/{uuid}/custom-domains | Add one (domain, edge, default true). 201 with the domain and its dns_records |
GET /applications/{uuid}/custom-domains/{domain} | One domain; ?refresh=1 checks the TXT record, DNS and the certificate again now |
PATCH /applications/{uuid}/custom-domains/{domain} | Turn the edge on or off (edge) |
DELETE /applications/{uuid}/custom-domains/{domain} | Remove it from the app and from the edge |
POST /applications/{uuid}/custom-domains/{domain}/purge-cache | Purge its edge cache. 202; 429 within a minute of the last purge; 409 when the edge is off |
{"domain": "www.shop.com", "edge": true, "status": "pending_verification", "verified": false, "routing": "server", "apex": false, "tls": "pending",
"verification_record": {"type": "TXT", "name": "_hostwolf-challenge.www.shop.com", "value": "hostwolf-verify=…", "required": true, "purpose": "verification"},
"dns_records": [{"type": "TXT", "name": "_hostwolf-challenge.www.shop.com", "value": "hostwolf-verify=…", "required": true, "purpose": "verification"},
{"type": "CNAME", "name": "www.shop.com", "value": "edge.app.hostwolf.net", "required": true, "purpose": "routing"}],
"cache": {"static_files": true, "respects_cache_control": true, "last_purged_at": null},
"monthly_price": 0, "error": null, "checked_at": "…"}
statusiscreating,pending_verification(add the TXT record fromverification_record; clients that wait foractivemust show it instead of waiting silently),pending_dns(add the DNS records),issuing_certificate,origin_pending(connecting to your server),active,error(seeerror) ordirect(the edge is off).routingisserver, ornearest_citywhen the app runs in several cities.tlsispendingoractive.- A record's
purposeisverification(the TXT that proves you own the domain;requiredistrueon the edge andfalsefor a domain served directly),routing(the CNAME, or A/AAAA when direct),ownership(an optional TXT record) orcertificate(a TXT record that is required when it is listed). verifiedistrueonce the TXT record was found;verification_recordis thennull.POSTanswers withrestart_required: true: deploy or restart the app so it answers on the domain.409means the domain is already used by another app or account; when the other holder has not verified it, the answer carriesverification_record(add it, thenPOSTagain). Docker Compose apps add domains per service on the console's Domains page.
SDK and MCP#
const d = await hw.customDomains.add(app.uuid, { domain: 'www.shop.com' });
console.table(d.dns_records);
const txt = pendingVerification(d); // the TXT record to add first, or null
await hw.customDomains.get(app.uuid, 'www.shop.com', { refresh: true });
await hw.customDomains.purgeCache(app.uuid, 'www.shop.com');
customDomains.list (with perPage and page), customDomains.all, setEdge and remove complete the set; verificationRecord(err) returns the TXT record from a 409; see the SDK reference. The MCP server has apps_custom_domains_list, apps_custom_domain_add, apps_custom_domain_status, apps_custom_domain_purge_cache and apps_custom_domain_remove. For a domain that is waiting for verification the add and status tools tell the assistant exactly which TXT record to give you.
CLI#
hostwolf apps domains my-app # the app's domains
hostwolf apps domains add my-app www.shop.com # prints the TXT record, then TYPE NAME VALUE REQUIRED
hostwolf apps domains status my-app # DOMAIN EDGE STATUS ROUTING TLS (every page)
hostwolf apps domains check my-app www.shop.com # same as status --refresh
hostwolf apps domains purge my-app www.shop.com
hostwolf apps domains edge my-app www.shop.com off
hostwolf apps domains remove my-app www.shop.com
See Variables and domains in the CLI reference.