Mobile app version of vmapp.org
Login or Join
BetL925

: Should fonts be served from a cookieless subdomain? 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

@BetL925

Posted in: #Fonts #StaticContent

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @BetL925

1 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme