Back to Blog

Subdomain Inception: How gov.lk Goes Multiple Levels Deep 🌐

👁️ ... views

🎯 How It Actually Works

Think of it like an address system:

gov.lk (main domain)
└── moe.gov.lk (Ministry of Education)
    └── ethaksalava.moe.gov.lk (e-Thaksalawa platform)
        └── cdn.ethaksalava.moe.gov.lk (CDN server)

Each level is just another DNS record. That’s it. No special permissions needed.


⚙️ Key Features

  • Unlimited depth – Technically up to 127 levels (but please don’t 😂)
  • Easy setup – Just add DNS records in your domain provider
  • Free – Domain එකක් තියෙනවා නම්, unlimited subdomains
  • Organizational – Clean way to structure your infrastructure
  • SSL compatible – Wildcard certificates cover multiple levels

💡 Why This Is Important

If you’re building anything beyond a basic website, subdomains are essential:

  • 🚀 SaaS appsclient1.app.yourdomain.com, client2.app.yourdomain.com
  • 📦 CDN setupcdn.yourdomain.com for faster content delivery
  • 🔧 Environmentsdev.yourdomain.com, staging.yourdomain.com, prod.yourdomain.com
  • 🌍 APIsapi.yourdomain.com, v2.api.yourdomain.com

Knowing this makes you look way more professional to clients. It’s that infrastructure-level knowledge that separates amateurs from pros. 💯


🛠️ How to Set It Up

Go to your DNS provider (Cloudflare, Namecheap, etc.) and add records like this:

Type    Name                        Value
A       imrishmika.site            203.0.113.1
A       cdn.imrishmika.site        203.0.113.2
A       edge.cdn.imrishmika.site   203.0.113.3

Or use CNAME for aliasing:

Type     Name          Value
CNAME    cdn           imrishmika.site
CNAME    edge.cdn      cdn.imrishmika.site

Wait පැයක් විතර for DNS propagation... then boom! ✅ Your multi-level subdomains are live.


💭 My Take

Honestly, the fact that DNS can handle infinite nesting is both powerful and dangerous. It’s powerful because you get insane flexibility. It’s dangerous because some devs go overboard and end up with stuff like:

api.v2.staging.internal.backup.legacy.oldapp.com 😭

What I actually respect about the gov.lk setup is its logical hierarchy — each level actually means something: ministry → department → service → infrastructure. That’s clean architecture right there. 🧩

For your own projects: keep it simple — 2 or 3 levels max unless you genuinely need more.

  • cdn.yourdomain.com → perfect
  • edge.cdn.yourdomain.com → still fine
  • node5.edge.cdn.backend.v2.yourdomain.com → bro chill 💀

The real power is understanding that subdomains aren’t magic — they’re just DNS records pointing to different IPs or services. Once you get that, you realize how much control you actually have. 🔥


💬 Your domain = your digital real estate. Subdomains = free floors you can build on top. Use them wisely, build them smartly! 🏗️

Comments (0)

Loading comments...

Leave a Reply