cname
Add a CNAME record to a domain's DNS zone on Cloudflare
- Command:
/go/cname - Category: DNS
- Required arguments:
<domain>and<target> - Output: Whatever
cloudflareprints (also logged to/var/log/go/cname.log) - Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also
Overview
/go/cname is a shortcut for adding a CNAME record through Cloudflare's API. It passes your arguments to cloudflare with the record type set to cname, so you don't have to type the --type option yourself.
A CNAME record makes one name an alias of another. For example, blog.example.com can point to example.ghost.io, and visitors are sent wherever the target points.
Quick start
# Add a CNAME record named "blog" for example.com that points to example.ghost.io
/go/cname example.com blog example.ghost.io
Syntax
# Name and target
/go/cname <domain> <name> <target>
# Target only
/go/cname <domain> <target>
| Form | Behavior |
|---|---|
/go/cname <domain> <name> <target> |
Adds a CNAME record called <name> that points to <target>. |
/go/cname <domain> <target> |
Adds a CNAME record that points to <target>, without passing a name. The name is then chosen by cloudflare. |
The form is chosen by counting arguments: if a third argument is given, the second one is the name.
Arguments
| Position | Argument | Required | Notes |
|---|---|---|---|
| 1 | <domain> |
Yes | The domain whose DNS zone is on Cloudflare. |
| 2 | <name> |
Only in the three-argument form | The record name, for example blog or www. |
| 2 or 3 | <target> |
Yes | The hostname the record points to. |
Arguments beyond the third are ignored. Nothing is validated by this command; all checks are done by cloudflare.
Output
The command prints nothing itself. Any output, including success and error messages, comes from cloudflare.
Every run is logged with its arguments and a timestamp, for example [Nov 20 09:15:02]# cname example.com blog example.ghost.io, to /var/log/go/cname.log.
Examples
# Point blog.example.com to a hosted blog service
/go/cname example.com blog example.ghost.io
# Point www.example.com to the main domain
/go/cname example.com www example.com
# Verify the record after it has been added
dig +short CNAME blog.example.com
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
An error from cloudflare about the domain or zone |
The domain isn't on Cloudflare yet. | Add it first with dns. |
| An authentication or API error | Cloudflare API credentials aren't set up for GoAdmio. | See cloudflare for the credentials it needs. |
| The record wasn't created, or the name is wrong | Only two arguments were given, so no name was passed. | Use the three-argument form with an explicit <name>. |
| Cloudflare reports that a record with that name already exists | A CNAME can't share a name with another record such as an A, MX, or TXT record. | Remove or change the existing record, or use a different name. |
| The site doesn't resolve after adding the record | DNS changes can take time to spread, or the target hostname is wrong. | Check with dig, and confirm the target is correct. |
| Unexpected behavior when an argument is missing | The command doesn't check its arguments. | Always pass at least <domain> and <target>. |
Details
How it works
The command only builds a call to cloudflare:
| Form | Command that runs |
|---|---|
| Two arguments | /go/cloudflare --domain <domain> --type cname --value <target> |
| Three arguments | /go/cloudflare --domain <domain> --type cname --name <name> --value <target> |
Other options of cloudflare, such as the proxy setting, are not available through this command. Use proxy to change the proxy setting afterwards, or call cloudflare directly.
The arguments are not quoted when passed on, so values containing spaces or special characters are split into several arguments. Hostnames don't contain these, so this normally doesn't matter.
Related shortcuts
cname is one of several shortcuts that add a single record type through Cloudflare: mx for MX records, txt for TXT records, and dkim, dmarc, and spf for email authentication records.
See also
| Command | Description |
|---|---|
cloudflare |
Manage DNS records using Cloudflare's API |
dns |
Add your domain to Cloudflare and edit the DNS zone |
mx |
Add an MX record to a domain through Cloudflare |
txt |
Add a TXT record to a domain through Cloudflare |
proxy |
Change Cloudflare's proxy setting |
google |
Add Google verification and Workspace DNS records via Cloudflare |