# Manage CDN domains

> Add, view, start, stop, and delete CDN domains, configure the CNAME, and switch between mainland China nodes and global nodes.

A CDN domain is the domain visitors use to reach the CDN. Each CDN domain has one origin and its own independent set of settings.

Entry point: **CDN › Static acceleration management (静态加速管理)** ([open](https://console.bitiful.com/cdn/list)).

## Add a CDN domain

Click **Add new domain (添加新域名)** in the upper-right corner, fill in the form, and click **Create (创建)**.

| Field                            | What to enter                                                                                                                                                  |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **CDN domain (加速域名)**            | Required. For example, `image.mywebsite.com`. No protocol, no wildcard (`*`), and not an official Bitiful domain. The domain must have an ICP filing.          |
| **Origin type (源站类型)**           | Required. **S4 bucket origin (S4 存储桶回源)** or **Custom origin (自定义回源)**. You can't switch between the two types after creation.                                 |
| **S4 bucket name (S4桶名称)**       | Required for S4 bucket origin. Choose from the buckets in your account.                                                                                        |
| **Origin address (源站地址)**        | Required for custom origin. Must start with `http://` or `https://`. For the rules, see [Origin settings](https://docs.bitiful.com/en/cdn/handbook/origin.md). |
| **Origin Host header (回源Host头)** | Optional for custom origin. If left empty, it's filled in automatically.                                                                                       |
| **Region (地区)**                  | Required. **Mainland China (中国大陆)** or **Global (全球)**. Defaults to Mainland China, and you can change it later.                                               |

After creation, the status is **Deploying (部署中)**. Deployment usually finishes within 30 seconds.

> **Note**
>
> A new domain has HTTPS off and no access restrictions by default. Continue with [HTTPS](https://docs.bitiful.com/en/cdn/handbook/https.md) and [access control](https://docs.bitiful.com/en/cdn/handbook/access-control.md) as needed.

### Messages when creation fails

| Message                                                                 | Cause and fix                                                                                                                       |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| "请先完成实名认证" (complete identity verification first)                       | Complete identity verification in [Account information](https://console.bitiful.com/users).                                         |
| "您当前已欠费，请先充值" (you have an overdue balance, please top up first)        | Your account balance is below 0. Top up and try again.                                                                              |
| "该域名尚未备案" (this domain has not been filed)                              | No ICP filing was found for the domain. For a domain whose filing just completed, you may need to wait for the filing data to sync. |
| "该域名已经存在" (this domain already exists)                                  | The domain has already been added as a CDN domain.                                                                                  |
| "目前不支持加速泛解析域名" (wildcard domains can't be accelerated yet)              | The CDN domain contains `*`.                                                                                                        |
| "请使用您自己的域名作为CDN的加速域名" (use your own domain as the CDN domain)           | You entered an official Bitiful domain.                                                                                             |
| "加速域名不能与源站域名相同" (the CDN domain can't be the same as the origin domain) | The domain in the custom origin address is the same as the CDN domain, which would cause a back-to-origin loop.                     |
| "如需回源S4存储桶，请使用“桶回源”" (to fetch from an S4 bucket, use bucket origin)    | The custom origin address is a Bitiful S4 domain. Choose S4 bucket origin instead.                                                  |
| "最多创建5个域名" (at most 5 domains can be created)                           | Each account can have up to 5 CDN domains by default. Contact Bitiful if you need more.                                             |

## Configure the CNAME

Every CDN domain has a fixed CNAME domain: `<CDN domain>.s4cdn.dogecast.com`. You can copy it from the **CNAME domain (CNAME 域名)** column of the list, or from **Domain details › Basic information (域名详情 › 基本信息)**.

At your domain's DNS provider, add a CNAME record that points the CDN domain to this address. The console checks resolution each time you open the list or details:

| List icon            | **CNAME configuration status (CNAME 配置状态)** in details | Meaning                                                                                  |
| -------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| Green check          | Configured (已配置)                                       | Resolution already points to Bitiful.                                                    |
| Red exclamation mark | Not configured (未配置)                                   | The record wasn't added, the record value is wrong, or the DNS cache hasn't updated yet. |

The CNAME domain doesn't change when you switch the acceleration region or change the origin, so you don't need to modify DNS records.

## Domain list

| Column                      | Description                                                                            |
| --------------------------- | -------------------------------------------------------------------------------------- |
| **Domain (域名地址)**           | Click to open details. The shield on the left shows HTTPS status. See the table below. |
| **Origin (源站)**             | A bucket origin shows `s4://bucket-name`. A custom origin shows the origin address.    |
| **CNAME domain (CNAME 域名)** | The CNAME address and resolution status.                                               |
| **Status (状态)**             | **Running (运行中)**, **Deploying (部署中)**, **Stopped (已停止)**.                             |
| **Actions (操作)**            | **Manage (管理)**, **Stop (停止)** or **Start (启动)**, **Delete (删除)**.                     |

Shield colors:

| Color  | Meaning                                                                                                         |
| ------ | --------------------------------------------------------------------------------------------------------------- |
| Gray   | HTTPS is off.                                                                                                   |
| Yellow | HTTPS is on, but among the CDN domains using the same certificate, at least one domain's CNAME isn't in effect. |
| Green  | HTTPS is on, and the CNAMEs of all CDN domains using the same certificate are in effect.                        |

The shield reflects only the HTTPS switch and CNAME resolution. Whether a certificate can renew automatically depends on whether it's an [auto certificate](https://docs.bitiful.com/en/certs-center/auto-cert.md).

## Status and deployment

| Status        | Meaning                                                                     | Can you change settings?                                                                                                                                                                                             |
| ------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Running**   | The configuration is in effect at the edge.                                 | Yes                                                                                                                                                                                                                  |
| **Deploying** | A new configuration is being pushed, or the domain is starting or stopping. | During a deployment caused by a settings change, you can keep saving, and new changes are queued and deployed in order. While the domain is starting or stopping, saving fails, so wait for the operation to finish. |
| **Stopped**   | The domain isn't serving traffic.                                           | No. Hovering over **Edit (编辑)** shows "当前状态不可修改配置" (settings can't be changed in the current state).                                                                                                                 |

After you save any setting on the details page, the status changes to **Deploying**, and deployment usually finishes within 30 seconds. The page doesn't update the status automatically, so click **Refresh (刷新)** in the upper-right corner of the details page, or the refresh icon in the upper-right corner of the list. During deployment, the page shows the new configuration being pushed. Deployment is complete only when the status returns to **Running**.

> **Note**
>
> The acceleration region is switched through DNS and doesn't go through the deployment process above. Visitors switch gradually as their DNS caches expire.

## Start and stop

- **Stop**: Click **Stop** and confirm. After you stop a domain, it resolves to an invalid address, and every resource accessed through it fails. This can take a few minutes to complete. If your business still uses the domain, switch DNS back to your origin or another service first, then stop it.
- **Start**: Click **Start** and confirm. The domain is redeployed with the configuration it had before it was stopped, and billing resumes. You can't start a domain while you have an overdue balance.

While a domain is deploying, the list doesn't show Start or Stop. If starting shows "该项目已被暂停使用" (this project has been suspended), the platform has suspended the domain. Follow the message and contact Bitiful.

When your account has an overdue balance, your domains are stopped, and they resume automatically after you top up. See [Overdue balances](https://docs.bitiful.com/en/prices/arrearage.md). The platform also rechecks ICP filings periodically. For a domain whose filing is no longer valid, you get an SMS notification first, and then the domain is stopped.

## Delete

1. **Stop** the domain first and wait until the status is **Stopped**.
2. Click **Delete** and confirm.

After deletion, all of the domain's settings are deleted with it, the CNAME domain stops working, and nothing can be recovered. Files at your origin aren't affected. Also delete the matching CNAME record at your DNS provider.

## Switch the acceleration region

Entry point: Domain details › **Access control (访问控制)** › **Acceleration region (加速区域)** › **Edit**.

| Option                    | Description                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Mainland nodes (大陆节点)** | Uses mainland China nodes only.                                                                                                                                                                                                                                                                                                                                |
| **Global nodes (全球节点)**   | Visitors in mainland China and overseas are served by the nearest node. Overseas nodes have a different data transfer price. See [Data transfer](https://docs.bitiful.com/en/prices/detail/transfer-prices.md). With a bucket origin, origin fetches from overseas nodes automatically optimize the cross-border route. Custom origins don't support this yet. |

After you save, visitors switch gradually as their DNS caches expire. Both regions require the domain to have an ICP filing.

> **Note**
>
> Some early CDN domains support mainland nodes only. They don't show **Edit** for the acceleration region, and their details page has no **Origin settings (回源设置)**.

## View in a bucket

Go to **Object storage › Bucket list › a specific bucket › CDN acceleration (对象存储 › 桶列表 › 具体的桶 › CDN加速)** to see the CDN domains that use this bucket as the origin, along with their status, CNAME, and HTTPS switch. Clicking **New CDN domain (新建CDN域名)** or **Manage domains (管理域名)** takes you to **Static acceleration management**.

## FAQ

<details>
<summary>Can I use a root domain (example.com)?</summary>

You can add it, but many DNS providers don't allow a root domain's CNAME to coexist with MX, TXT, and other records. We recommend using a subdomain, such as `cdn.example.com`.

</details>

<details>
<summary>Can I skip the ICP filing for overseas business?</summary>

No. The filing is checked when you select **Global** too.

</details>

<details>
<summary>A bucket-origin domain I added earlier isn't in the list</summary>

If the origin bucket has been deleted or isn't in your current account, the domain doesn't appear in the list. Contact Bitiful to resolve it.

</details>

<details>
<summary>I added the CNAME, but it still shows Not configured</summary>

Confirm the record value exactly matches the **CNAME domain**, and that the CDN domain doesn't pass through another CDN. If the old TTL on the DNS record hasn't expired, wait for it, then refresh the list.

</details>
