Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why is it that that nobody ever mentions serving fonts over a cookieless (sub)domain?

Is it because you have to white-list your primary domain with Access-Control-Allow-Origin for font files?

I'm asking because I want to know if there's some reason not to do it.

share|improve this question
You've answered your own question Access-Control-Allow-Origin - most people do not know that this is a requirement. – Simon Hayter Jun 26 '13 at 18:43
This also applies when setting up fonts on a CDN which is more common than using a sub domain due to even more speed benefits. – Simon Hayter Jun 26 '13 at 19:42
I see. Thanks for confirming my suspicion. And that's a good point on the topic of CDNs. – Mister Dood Jun 27 '13 at 1:57

It doesnt have to be a subdomain, but you want to serve all your static resources (javascript, fonts, images, and css) from a different domain (subdomain or totally different). The reason you do this is because when your site sets a cookie on its main domain, that cookie is sent back and forth on every possible request. Since static resources (fonts, css, javascript) dont do much with server side cookies (unless if you change your webservers handler mappings), then you dont want to waste the extra bandwidth by sending the cookie data with every request. Also not having cookies on these requests allows for proper caching by browsers and proxies.

Good practice dictates using a real domain for your site, and then a cookieless domain for all other static resrouces which are the same to all visitors. Eventually you can move that content to a CDN like cloudfront and get some speed improvements. If you use a CDN like MaxCDN they have features which strip cookies for you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.