# Give every app an address

With a default domain, every app gets a web address of its own as soon as you add it to a server that can use the domain. The address is the app's name under the domain: an app called Shop Front answers at `shop-front.apps.example.com`. Coresmith gets each address's certificate when the app goes live.

On Coresmith Cloud this is already done for you. Every app answers at its name under `coresmith.app`, like `shop-front.coresmith.app`.

## Set the default domain

Owners and admins can set it.

1. Open **Settings**, **General**.
2. On **Default domain for apps**, choose **Set a domain**.
3. Enter a domain you own, such as `apps.example.com`, and choose **Save**.

Coresmith then checks each of your connected servers. Every server gets a row on the card: **Ready** when its apps can use the domain, or **Not ready** with what's missing and any record to add.

## Point the domain at your servers

Do one of these.

- **Let Coresmith add the records.** If the domain's DNS is on Cloudflare, give Coresmith a Cloudflare token under **Settings**, **General**, **Address**, with **Zone**, **DNS**, **Edit** for the domain's zone. Coresmith then adds each app's record itself, pointed at the server the app runs on, and leaves records it didn't add alone. This works with any number of servers.
- **Add a wildcard record.** At your DNS provider, add an A record for `*.apps.example.com` pointing at your server's IPv4 address, and an AAAA record for its IPv6 address if it has one. The card shows the exact records with copy buttons. A wildcard reaches one server, so apps on your other servers need the Cloudflare token or domains of their own.

A server that takes visitors [through Cloudflare](/docs/servers/ipv4-through-cloudflare) needs the token, since its records go through the tunnel. Use the zone itself as the default domain, such as `example.com`. Cloudflare's free certificate covers names one level under the zone, so `shop.example.com` works, but `shop.apps.example.com` would show visitors a certificate error.

## Which apps get an address

- Apps you add from now on get one straight away on a server marked **Ready**, even when you type a domain of your own. Your domain stays primary, and the default address answers beside it.
- Apps you added before get theirs at their next deploy.
- An app's address starts as its name in lowercase, with hyphens for spaces and dots, and without other symbols: an app called `dev.example.com` answers at `dev-example-com.apps.example.com`. Two apps can't share one, so when you add or rename an app, Coresmith asks for another name if a different app already has that address, or if Cloudflare already has a record for it that Coresmith didn't add.
- An app whose name's address another app had first has no default address. Its **Domains** card says so. [Pick another address](#pick-another-address), or rename the app, to give it one.

The app's page lists the address on its **Domains** card, marked **default**, or **primary** when it's the app's only domain.

## Rename an app

Renaming an app moves its address to the new name straight away, and the old address stops working. An address you [picked yourself](#pick-another-address) stays where it is. The **Rename app** box shows the new address as you type. If the app's `APP_URL` variable pointed at the old address, Coresmith changes it to the new one, ready for the next deploy.

If the app's server can't use the domain yet, the old address still goes, and the new one waits. Once the server can use it, the app gets the new address at its next deploy, or straight away when you choose **Add the address** on its **Domains** card. If you choose it too early, Coresmith says why it can't add the address yet.

## Pick another address

1. On the app's **Domains** card, choose **Add domain**.
2. Type the name you want before the default domain, such as `shop` for `shop.apps.example.com`. Use letters, numbers and dashes.
3. Choose **Save address**.

The new address replaces the old one straight away, and the old one stops working. If the app's `APP_URL` variable pointed at the old address, Coresmith changes it to the new one, ready for the next deploy. An app has one default address, so picking another always replaces it.

An address you pick stays when you rename the app. To have it follow the name again, pick the address the name gives. To add a domain you own instead, choose **Use your own domain instead** in the same box.

## Take an address off an app

On the app's **Domains** card, choose the remove button beside the address, then **Remove**. The app keeps its other domains, and Coresmith doesn't give the address back on its own. To bring it back, choose **Add the address** on the same card.

## Change or turn off the default domain

Choose **Change** on the card to use another domain. Each app moves to the new domain at its next deploy.

Choose **Turn off** to stop giving out addresses. Apps keep theirs until their next deploy, and then lose them.

## On Coresmith Cloud

Every app gets its name under `coresmith.app`, and there's nothing to set up. Every app on Coresmith Cloud shares that domain, so no two apps can have the same address there. Coresmith asks for another name if another app already has the address, or if the name could pass for Coresmith's own, such as `admin` or `login`. You can [pick another name](#pick-another-address) for an app's address under `coresmith.app`, one per app, and add domains you own as usual. [Add a domain](/docs/apps/domains).
