Ferdigheter · Domener
Put an app on its own domain
Add a custom domain such as www.example.no to an app, give the user the DNS records to create, verify it and follow it until it serves over HTTPS.
Every app answers on its own address under skybu.app. A custom domain adds a name the user owns. The user proves control with a TXT record and points the name at the app; Skybu then gets a certificate and serves the app on it. You add and verify the domain; the user creates the DNS records at their DNS provider.
In short
get_apporlist_projectsto find the app's id.add_domainwith the hostname. It returns the TXT record and where to point the name.- Give the user both records and wait until they say they are in place.
verify_domain. Then follow it withlist_app_domainsuntil the status isactive.
Step 1: add the domain
{ "name": "add_domain", "arguments": { "appId": "<app id>", "hostname": "www.example.no" } }
Send the hostname only: no https://, no path. Skybu lowercases it and refuses:
| Code | Why |
|---|---|
invalid_domain | Not a hostname (letters, digits and hyphens, at most 253 characters). |
domain_ip_address | An IP address. |
domain_wildcard | *.example.no. Add each hostname on its own. |
domain_reserved | A name under skybu.app, skybu.no or another name Skybu uses, or a special-use name such as .local or .internal. |
domain_taken | Another app on Skybu already has it. |
domain_limit_reached | The app has 5 custom domains, the most it can have. |
The answer has the domain's id, its status (pending), a txt record and a target.
Step 2: the DNS records
Two records, both made by the user at their DNS provider.
Prove control. A TXT record named _skybu-challenge.<domain> with the value from txt.value:
_skybu-challenge.www.example.no TXT "skybu-…"
Send the traffic to the app. What to create depends on target.apex:
apex: false(a subdomain such aswww.example.noorapp.firma.no): a CNAME totarget.cname, the app's own address.www.example.no CNAME <app>.<org>.skybu.app
apex: true(a bare domain such asexample.noorola.priv.no): it cannot have a CNAME. Tell the user to point it attarget.cnamewith ALIAS, ANAME or CNAME flattening if their DNS provider has one of these, so it follows Skybu if its addresses change. Only if the provider has none, create A records for every address intarget.addresses, and update them if Skybu's addresses change. Suggesting thewwwname instead is often simpler.
Skybu does not serve IPv6; AAAA records pointing elsewhere are flagged as not Skybu's.
Step 3: verify
Once the user says the TXT record is in place:
{ "name": "verify_domain", "arguments": { "domainId": "<domain id>" } }
Verification checks only the TXT record. If it is missing or wrong, the call fails with domain_verification_failed and says which: no TXT record at the name, a record without this domain's value, or a DNS lookup that failed (try again in a minute). DNS changes can take a few minutes; wait and verify again. The domain stays pending with the reason in error.
On success the domain is verified, and Skybu requests a certificate. The certificate is issued only once the name points at the app, so the CNAME (or ALIAS, or A records) must be in place too.
Step 4: follow it
{ "name": "list_app_domains", "arguments": { "appId": "<app id>" } }
list_domains lists the domains of every app in the organisation.
| Status | Meaning |
|---|---|
pending | Waiting for the TXT record. Run verify_domain once it exists. |
verified | Control proven. Skybu is requesting the certificate. |
issued | The certificate is there; the domain is being set up on the gateway. |
active | Serving the app over HTTPS. url is the https:// address. Plain HTTP redirects to HTTPS. |
failed | The certificate authority refused. error has its reason. Fix the cause (usually the name does not point at the app yet), then verify_domain again to retry. |
Each domain also has routing: Skybu checks what the name points to every minute until the domain is active, every half hour after, and on every verify_domain. null means fine; otherwise routing.problem is one of:
| Problem | Tell the user |
|---|---|
no_record | Nothing points the name at Skybu yet. Create the CNAME (or ALIAS). |
a_records | A subdomain uses A records instead of the CNAME. It works now, but stops working if Skybu's addresses change. Replace them with the CNAME. |
elsewhere | The name points to routing.addresses, which are not Skybu's. Replace those records, or visitors reach another server. |
missing | A bare domain on A records lacks one of Skybu's addresses (routing.addresses). Add it, or use ALIAS. |
On a domain that is already verified, issued or active, verify_domain only checks the routing again: a quick way to clear a warning the user has fixed.
Things to know
- Leave the TXT record in place after verification. Verifying a
faileddomain checks it again. remove_domaintakes the domain off the app at once and deletes its certificate. Confirm with the user first; the app keeps itsskybu.appaddress.- A members-only app (
skill://access/members-only-apps) asks for sign-in on its custom domains too. - Every step is in the organisation's audit log.
- The CLI has the same:
skybu domain add <app> <hostname>,skybu domain verify <hostname>,skybu domain list,skybu domain delete <hostname>. In the dashboard it is the app's Domains tab.