当前位置 : 主页 > 网络安全 > 测试自动化 >

性能 – 托管静态内容的位置:子域或不同的域?

来源:互联网 收集:自由互联 发布时间:2021-06-22
将我们的应用程序静态内容托管在一个完全不同的域上,而不是像其他域一样托管我们主域的子域是否有任何好处?例如,微软使用i.microsoft.com,谷歌使用gstatic.com,雅虎使用yimg.com,Stackover
将我们的应用程序静态内容托管在一个完全不同的域上,而不是像其他域一样托管我们主域的子域是否有任何好处?例如,微软使用i.microsoft.com,谷歌使用gstatic.com,雅虎使用yimg.com,Stackoverflow使用sstatic.net

提前致谢

应该是不同的域名.

来自雅虎的Best Practices for Speeding Up Your Web Site

When the browser makes a request for a static image and sends cookies together with the request, the server doesn’t have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host 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’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. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

网友评论