# Using your own domain

Every app gets an address like `grocery.homespunapps.com` the moment it is deployed. If you own a domain, you can put the app on that instead: `shop.yourname.com`, or `yourname.com` itself.

The app keeps its `homespunapps.com` address as well. Both work, and nothing about the app changes.

## What you need

[Section titled “What you need”](#what-you-need)

A domain you already own, and the ability to add DNS records for it, wherever it is registered. GoDaddy, Namecheap, Cloudflare, anywhere. You do not need to move the domain, change registrar, or create an account anywhere new.

## Setting it up

[Section titled “Setting it up”](#setting-it-up)

Ask your agent, in whatever words you would normally use:

> Put this app on shop.example.com

Or do it yourself in the console: open the app, find the **Domain** panel, and add the domain there. From the command line it is:

Terminal window

```
homespun apps domain add <app> shop.example.com
```

All three do the same thing, and all three hand you back a short list of DNS records.

## The part only you can do

[Section titled “The part only you can do”](#the-part-only-you-can-do)

**Publish those DNS records at your domain provider.** This is the step nothing can do for you: it is how you prove the domain is yours. There will be one or two records:

| Record                                       | Why                           |
| -------------------------------------------- | ----------------------------- |
| `CNAME` pointing at `cname.homespunapps.com` | routes the traffic            |
| sometimes a `TXT` record                     | proves you control the domain |

Add exactly what you were given. If your domain is itself on Cloudflare, set the CNAME to **DNS only** (the grey cloud) rather than proxied, or the request never reaches Homespun.

Then wait. A certificate is issued for your domain automatically, usually within a minute or two. You can watch it with:

Terminal window

```
homespun apps domain show <app>
```

or by pressing Refresh in the console, or by asking your agent whether the domain is active yet. The status goes from `pending` to `active`, and the app is live on your address.

If you see **“custom hostname does not CNAME to this zone”** before then, it simply means the DNS records have not propagated yet. It clears itself. No action needed.

## Bare domains: the one wrinkle

[Section titled “Bare domains: the one wrinkle”](#bare-domains-the-one-wrinkle)

`shop.example.com` works anywhere. `example.com` on its own is harder, and the reason is DNS itself rather than Homespun: the standard does not allow a plain CNAME at the root of a domain.

Providers work around this with a record type usually called ALIAS or ANAME. Cloudflare, Namecheap, Route 53 and DNSimple have one. GoDaddy’s basic DNS does not.

So if you want the bare domain and your provider has no ALIAS record, you have two options:

* **Use `www` instead**, and point the bare domain at it with your provider’s forwarding.
* **Move DNS hosting** (not the registration) to a provider that supports ALIAS records.

## Both `example.com` and `www.example.com`

[Section titled “Both example.com and www.example.com”](#both-examplecom-and-wwwexamplecom)

Add them both. The first domain you add serves the app; every one after it redirects there, keeping the path and query intact. So visitors reach the same place whichever they type, and search engines see one address rather than two competing copies of the same page.

Each domain counts against your account’s domain allowance, including the redirecting ones.

## Removing a domain

[Section titled “Removing a domain”](#removing-a-domain)

Remove it in the console, with `homespun apps domain remove <app> <domain>`, or by asking your agent. It stops serving within seconds.

Two things worth knowing:

* **Removing the serving domain also removes the ones that redirect to it**, since a redirect pointing at a domain the app no longer holds would send visitors nowhere. The console warns you when this is about to happen.
* **Delete the DNS record at your provider too.** Until you do, your domain still points at Homespun and visitors get an error page rather than your own.

## One limitation, stated plainly

[Section titled “One limitation, stated plainly”](#one-limitation-stated-plainly)

If the app is **private**, signing in from your custom domain finishes on the app’s `homespunapps.com` address rather than yours. The app is still gated correctly, and members still get in; the sign-in step just briefly shows the other address. Public and link apps are unaffected.
