Failed to add a subdomain

Hi, I want to set up a subdomain like “dev-c–.js.org” to my project(dev-c-minus-minus.netlify.app), but when I clicked “Verify”, it said “Invalid domain name” to me, but in other hosting providers, I can successfully add it.

Hi @cheese233,

Thanks for reaching out!

dev-c–.js.org doesn’t appear to be a valid domain name. I don’t believe the domain name can end with a hyphen. Can you confirm this s the correct domain name? Also can you clarify what tool you used to verify that is was valid?

Hi,
I used Cloudflare to configure the network, and it was successfully set up. Then, when I used GitHub Pages to deploy it, it performed well:


But I just can not successfully add it to the netlify.

By the way, here’s the dns lookup result:

{
  "Status": 0 /* NOERROR */,
  "TC": false,
  "RD": true,
  "RA": true,
  "AD": false,
  "CD": false,
  "Question": [
    {
      "name": "dev-c--.cheese233.eu.org.",
      "type": 1 /* A */
    }
  ],
  "Answer": [
    {
      "name": "dev-c--.cheese233.eu.org.",
      "type": 5 /* CNAME */,
      "TTL": 300,
      "data": "cheese233.github.io."
    },
    {
      "name": "cheese233.github.io.",
      "type": 1 /* A */,
      "TTL": 3600,
      "data": "185.199.111.153"
    },
    {
      "name": "cheese233.github.io.",
      "type": 1 /* A */,
      "TTL": 3600,
      "data": "185.199.110.153"
    },
    {
      "name": "cheese233.github.io.",
      "type": 1 /* A */,
      "TTL": 3600,
      "data": "185.199.108.153"
    },
    {
      "name": "cheese233.github.io.",
      "type": 1 /* A */,
      "TTL": 3600,
      "data": "185.199.109.153"
    }
  ],
  "Comment": "Response from 173.245.58.148."
}

As noted already, a domain/subdomain cannot begin or end with a hyphen.

Read RFC 1035 section 2.3.1 Preferred name syntax:

They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen.

This is also noted in the Wikipedia Article on DNS under Domain name syntax, internationalization which states:

Labels may not start or end with a hyphen.

This links to RFC 3696 which states under section 2. Restrictions on domain (DNS) names:

If the hyphen is used, it is not permitted to appear at either the beginning or end of a label.

E.g. this-is-ok.example.com but this-is-not-ok-.example.com

Would appear not everyone follows/implements standards. Seem Netlify does.