Skip to main content

Custom domains

Every app is served on an AppHaven address like myapp-p123.ams1.apphaven.app, one for each entry point (each service and port in your manifest). You can serve an entry point on your own hostname instead, such as app.example.com. HTTPS is set up for you.

Before reaching for your own domain, you can also give the app a short address of your choice on apphaven.app, such as shop.apphaven.app. No DNS work is needed for that one; see Choose your app's address.

A custom domain takes two steps: prove you own the domain, once per project, and then attach a hostname to an app.

Chosen addresses and custom domains both belong to one entry point of the app. A website and a CMS in the same app can have www.example.com and cms.example.com, each with its own access setting.

Choose your app's address​

Give your app a name of its own, and its production deployment is served on https://<name>.apphaven.app, for example https://shop.apphaven.app. HTTPS works the moment the address is live, with nothing to set up on your side. In an app with several entry points, the address serves the one you attach it to.

You pick the address when you create the app, in the Address field right under the app name. It follows the app name as you type it; edit it by hand and it stays as you set it. The console checks whether the address is free when you leave the field, and the app claims it when you choose Deploy. The address is then yours, and the first deploy decides where it goes:

  • If the app has one entry point (one service with one port, the usual case), the address is attached to it and serves your app as soon as it is live.
  • If the app has several, the address waits in Settings > Domains, marked as not attached yet. Pick the entry point it is for there; until then it does not serve anything.

To add or change the address of an existing app, open the app, go to Settings > Domains and use Change address. With several entry points, choose which one the address is for.

Choosing an address needs a project with a payment method. Without one, the field shows the app's generated address, and you can deploy right away; add a payment method under Usage & Billing > Payment methods and claim a name later in Settings.

Naming rules​

An address:

  • is 5–40 characters long, using lowercase letters, digits and hyphens;
  • starts with a letter, does not end with a hyphen and has no two hyphens in a row;
  • does not end in -p followed by digits, the pattern of generated addresses.

Some names are reserved, such as names we use for our own services and well-known brand names. If a name is not available, the check says whether it is reserved, already taken or recently released.

How the address behaves​

  • One address per entry point. It serves that entry point of the app's production deployment. Preview deployments keep their own generated addresses.
  • Changing it moves the entry point to the new address once that one is live. The old address stops serving; it does not redirect.
  • Moving it to another entry point of the same app is done in Settings > Domains.
  • With a custom domain on the same entry point, the custom domain is its main URL and both keep serving.
  • Renaming the app changes none of its addresses.
  • Releasing it, by removing the address or deleting the app or project, keeps the name for your project for 30 days. In that time only your project can claim it again, so links and bookmarks to it never land on someone else's app.

Use your own domain​

1. Verify the domain​

Open Project settings and find the Domains card.

  1. Choose Add domain and enter the domain itself, without https:// or a path. For app.example.com, add example.com.
  2. The card shows a TXT record with a Name and a Value. Create it with your DNS provider. The name is _apphaven-verification.example.com and the value starts with apphaven-verification=.
  3. Wait for the badge to turn Verified. AppHaven checks on its own; use Check now if you want an immediate answer.

Many DNS providers add the domain to whatever you type in the name field. If yours does, enter the relative name the card shows underneath the record, _apphaven-verification, or you will end up with _apphaven-verification.example.com.example.com.

Leave the TXT record in place. AppHaven re-checks it regularly, and removing it un-verifies the domain.

Once the domain is verified, every hostname at or below it is available to every app in the project. app.example.com, admin.example.com and example.com itself all come with the one record.

2. Attach a hostname to your app​

Open the app, go to Settings, and find the Custom domain card.

  1. Enter the hostname you want, for example app.example.com. If the app has several entry points, choose the one the hostname is for.
  2. Choose Add hostname. The card now shows the DNS record to create.
  3. Create that record with your DNS provider. It is a CNAME pointing at the entry point's AppHaven address, which the card gives you in full.

If your provider offers a proxy or CDN in front of the record, such as Cloudflare's orange cloud, turn it off. The record has to resolve to AppHaven for the certificate to be issued and renewed.

Watching it go live​

The card shows where the hostname has got to:

StatusMeaning
PendingWaiting for your DNS record to point at AppHaven.
ConfiguredTraffic is routed. The HTTPS certificate is being issued.
LiveThe certificate is in place and the hostname is serving.
ErrorThe card explains what went wrong.

Going from Pending to Live usually takes a few minutes, most of it DNS propagation. Certificates are issued by Let's Encrypt and renewed automatically.

Your app keeps answering on its AppHaven address the whole time. At Live the custom hostname takes over for its entry point: it becomes the URL shown for that entry point in the console, in the CLI and on the consumer dashboard, and it is the address your app's login returns to if the entry point is protected by access control.

Removing a hostname​

Use Remove on the Custom domain card. The status goes to Releasing while the change rolls out, and the entry point returns to its AppHaven address. You can then delete the DNS record with your provider.

When an entry point leaves the manifest​

If a deploy no longer has the service and port an address is attached to (a changed port or a renamed service), the address is held: it stays with your app, is not released and serves nothing. Settings > Domains shows it with the choice to attach it to another entry point or release it. apphaven validate --app <app> warns before you push; the deploy result in the console shows the same warning after the deploy. See Ports and addresses.

Removing the verified domain in Project settings is a separate step, and frees one of the project's domain slots. Remove the hostnames under it from their apps first: a domain that still has one attached cannot be removed.

Limits​

Verified domains per project3
Custom hostnames per entry point1
Chosen apphaven.app addresses per entry point1
Domain verification attempts5 per 24 hours
Check nowonce every 30 seconds per domain

Custom hostnames are subdomains, like app.example.com. To serve an app on a bare domain such as example.com, contact support.

Where to go next​