Key takeaways
- “CDN multiple domains” can mean three things: spreading files over several hostnames (sharding), serving files from your own hostname (a CNAME), or using more than one CDN (multi-CDN).
- Browsers open up to six connections per hostname on HTTP/1.1. That is why sharding became common.
- HTTP/2 sends many requests over one connection, so sharding often helps little. It can slightly hurt pages with many small files.
- Cloudinary supports private CDN hostnames and custom delivery hostnames (CNAMEs) on the Advanced plan and higher.
Understanding CDN multiple domains
Companies that utilize multiple websites – whether for international use or just multiple projects – want to be as efficient as possible. They want to ensure their users have the best possible experience, which usually means they need to rely on unique strategies to make it happen.
“CDN multiple domains” is a loose term. It can describe three different setups, so pick the right meaning before you plan.
What Is a CDN?
Content Delivery Networks (CDNs) are a group of distributed servers that help speed up the delivery of media to a website or application. A CDN keeps copies of your files in many places, so people download them from a nearby server.
A CDN is ideal if you have a large website with lots of images or videos that need to be downloaded quickly by users all over the world. If your site has only one server and all its content is stored there, it will take longer for users in different countries to access the same page. CDNs can help speed up this process by putting copies of all your files on servers closer to where those users are located and caching them for future visits.
What Are CDN Multiple Domains and How Do They Work?
As you might guess from the name, CDN multiple domains host various domains on the same CDN. This can be useful for load balancing, as it allows you to spread your traffic across all your different sites. It also allows you to host multiple versions of your site on the same CDN.
For example, if you have a staging and production version of your website or app that must always be kept in sync, using CDNs with multiple domains will allow them to live on the same server without interfering with each other’s workloads. It also enables a better experience for users across the globe, as they can automatically connect to a CDN closer to them, improving page load speed.
| Meaning | What it is | Why teams do it |
|---|---|---|
| Domain sharding | Serving files from several hostnames, such as img1.example.com and img2.example.com | To open more parallel connections on HTTP/1.1 |
| Custom delivery hostname (CNAME) | Serving files from your own hostname, such as media.example.com | Brand consistency and cleaner URLs |
| Multi-CDN | Using more than one CDN provider | To get better features, coverage, or speed in different places and at different times |
Does Domain Sharding Still Help?
On HTTP/1.1, browsers limit parallel connections to about six per hostname. Teams spread files over more hostnames to get around that. HTTP/2 changed the picture. It sends many requests over a single connection. It also lets the browser reuse a connection for another hostname when both resolve to the same IP address and share a certificate.
A 2017 study found that sharding can slightly hurt HTTP/2 speed for pages with many small files. It helped most for large files. Each extra hostname also adds a DNS lookup and a new connection.
What Are the Benefits of Having CDN Multiple Domains?
There are several benefits to using CDN multiple domains:
- It improves performance and reduces latency by allowing your users to access content from the closest server possible. This helps reduce load times and makes your site faster overall.
- It separates concerns by allowing you to host different parts of your site on different hostnames, so a problem affecting one hostname does not automatically affect the others.
- Using multiple CDNs can offer you better reliability too. If you’re only using one CDN for your sites and it goes down, you can do nothing to stop it. But with multiple CDNs, you can easily swap them out in the event of downtime.
- A custom delivery hostname keeps media on your own domain, which is simpler for brand consistency and cleaner URLs.
When Should You Use Each Option?
- Skip sharding on HTTP/2 or HTTP/3 unless a test shows a gain.
- Use a CNAME when you want media served from your own hostname.
- Use multi-CDN when you need coverage or features that one provider can’t give.
How to Test a Domain Change
- Measure a baseline for Largest Contentful Paint and total load time.
- Change one thing at a time, such as adding a CNAME.
- Test on slow and fast networks.
- Compare the results, then keep or undo the change.
Common Mistakes With CDN Domains
- Sharding on HTTP/2 out of habit. The advice predates HTTP/2 and now usually costs more in DNS lookups and connections than it saves.
- Adding a hostname without measuring. Every extra hostname is a DNS lookup and a TLS handshake for the first request.
- Splitting cacheable assets across hostnames. The same file served from two hostnames is cached twice and warmed twice.
- Treating multi-CDN as failover only. Without health-based routing, a degraded CDN keeps serving slowly instead of being routed around.
- Forgetting the certificate. A custom hostname needs its own certificate, and connection reuse depends on it.
How Does Cloudinary Handle Multiple Domains?
If you’re looking for a robust solution to manage your digital assets, Cloudinary everages multiple CDNs out of the box to optimize your site’s experience. Plus, the image and video transformation API can shape your media to your exact needs.
By default, Cloudinary delivers from a shared CDN at res.cloudinary.com. It also supports a private CDN and custom delivery hostnames (CNAMEs). Private CDN distributions and CNAMEs are available only on the Advanced plan and higher, and they need a small setup on the Cloudinary side.
Shared CDN: https://res.cloudinary.com/<cloud_name>/image/upload/sample.jpg
Private CDN: https://<cloud_name>-res.cloudinary.com/image/upload/sample.jpg
CNAME: https://www.example.com/image/upload/sample.jpg
The Cloudinary documentation also covers multi-CDN setups. It notes that one CDN may suit a feature or a region better, and that the best choice can change by time of day.
Frequently Asked Questions
What are CDN multiple domains?
It’s a loose term. It can mean domain sharding, a custom delivery hostname (CNAME), or the use of more than one CDN.
What is a CNAME for a CDN?
A CNAME is a DNS record that points your own hostname, such as media.example.com, to a CDN. Visitors see your hostname, and the CDN serves the files.
Is domain sharding obsolete?
It’s much less useful on HTTP/2 and HTTP/3, which use one connection for many requests. Test before you use it.
What is multi-CDN?
Multi-CDN means using more than one CDN provider and routing traffic between them. Teams do it to improve coverage, features, or reliability.
Does Cloudinary support custom domains?
Yes. Cloudinary supports custom delivery hostnames (CNAMEs) and private CDN distributions on the Advanced plan and higher. They need a small setup on the Cloudinary side.
