Dustin Getz
Dustin Getz

Reputation: 21801

why do CDNs always use a seperate host instead of subdomain?

a mirroring CDN can't have the same hostname as you application server, because you need a way for the CDN to explicitly reference the application.

Why, in general, do sites like facebook run their CDN on a totally seperate host, not just a subdomain like cdn.facebook.com? example: http://profile.ak.fbcdn.net/hprofile-ak-snc4/173706_6103645_790537_q.jpg

Is the reason, that they can construct resource URLs with many different hostnames, to avoid the 4-connections-per-host limit on some browsers?

Upvotes: 3

Views: 221

Answers (2)

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340933

If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies.

From: http://developer.yahoo.com/performance/rules.html#cookie_free

Upvotes: 2

ptomli
ptomli

Reputation: 11818

Because user generated content can contain nasties that may be able to access data hosted on the primary domain.

It also stops things like cookies and authentication getting sent in the request to CDN content.

Preventing users from inserting scripts, and at the same time allowing user submitted html is extremely difficult to do on the server side - ergo we must have sandboxing.

Borrowed from a fairly old whatwg post

Upvotes: 0

Related Questions