域名与主机名的区别解析及子项目名称验证咨询
Hey there! Let me break this down using your Atlassian example—no confusing tech jargon, just plain language.
域名(Domain) vs 主机名(Hostname): The Atlassian Example
Let’s start with the basics using the URLs you mentioned:
- Domain:
atlassian.netis the domain. Think of this as the "family name" for all of Atlassian’s online services. It’s a registered, global identifier that ties every related service together. It’s like the name of your apartment building—everyone living there shares that building name. - Hostname:
myproject.atlassian.netis the full hostname. This is the specific address that points to a single, unique service (your project space). It’s made by adding a custom prefix (myproject) to the domain. You can think of this as your full apartment address: building name + your unit number, which lets people find exactly where you live.
To put it simply:
- The domain is the shared suffix that all your services live under.
- The hostname is the full, specific address for one individual service (like a project, a blog, or a tool) within that domain.
How to Validate Subproject Names (Hostname Prefixes)
When building a system like Atlassian’s, you need to make sure the subproject names (the myproject part) are valid and unique. Here’s how to do it:
- Check format rules first:
- Only allow lowercase letters (a-z), numbers (0-9), and hyphens (-)
- Don’t let the name start or end with a hyphen (DNS rules don’t allow this)
- Keep it between 1-63 characters long (each "label" in a DNS name can’t exceed 63 characters)
- Verify uniqueness:
- Run a check against your internal database or DNS records to make sure no other project is already using that prefix. For example, if someone already created
myproject.atlassian.net, you need to tell the user to pick a different name.
- Run a check against your internal database or DNS records to make sure no other project is already using that prefix. For example, if someone already created
- Filter out reserved words:
- Block common system or service names like
www,admin,api,mail, or any brand-specific terms that might cause confusion. You don’t want a user creatingadmin.yourdomain.comand pretending to be your support team.
- Block common system or service names like
- Add real-time feedback:
- As the user types their desired name, show them instantly if it’s valid/available. This is way better than making them submit the form and then getting an error later.
Hope this clears up the confusion! If you have more questions about implementing any of these checks, feel free to ask.
内容的提问来源于stack exchange,提问作者Oleg Gello
相关产品推荐
相关产品推荐

