Where to place static content: a subdomain or another domain?

Are there any advantages to hosting our static application content on a completely different Domain, rather than on a host in a subdomain of our main domain, like the others? for example, Microsoft uses i.microsoft.com, Google uses gstatic.com, Yahoo uses yimg.com, Stackoverflow uses sstatic.net

Thanks in advance

+4
source share
2 answers

This must be a different domain.

From Yahoo Website Acceleration Recommendations

When the browser makes a request for a static image and sends cookies along with the request, the server does not use these cookies. Thus, they create network traffic for no good reason. You must ensure that static components are requested with requests without cookies. Create a subdomain and place all your static components there.

If your domain is www.example.org, you can host your static components on static.example.org. However, if you have already set cookies on top-level example.org and not on www.example.org, then all requests to static.example.org will contain these cookies. In this case, you can buy a completely new domain, place your static components there and save this file without cookies. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

+9
source

Images must be in another domain (or in the CDN domain). CSS, on the other hand, can benefit from being hosted in a ROOT domain, that is, in the same domain as your web server. See this experiment, which proves the best loading time: http://www.jonathanklein.net/2014/02/revisiting-cookieless-domain.html

+1
source

Source: https://habr.com/ru/post/1394261/


All Articles