单独的图像服务器(例如images.mydomain.com)的优缺点? [英] Pros and Cons of a separate image server (e.g. images.mydomain.com)?

查看:40
本文介绍了单独的图像服务器(例如images.mydomain.com)的优缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的网站提供了一些图片和 PDF 文档.这些图像和文档存储在源代码管理中,并在部署时复制内容.我们正在考虑创建一个单独的图像服务器来放置我们的库存图像和 PDF 文档 - 从而显着减少我们部署包的数量.

We have several images and PDF documents that are available via our website. These images and documents are stored in source control and are copied content on deployment. We are considering creating a separate image server to put our stock images and PDF docs on - thus significantly decreasing the bulk of our deployment package.

有人对这种方法有经验吗?

Does anyone have experience with this approach?

我想知道任何问题"——比如 XSS 问题和/或浏览器问题,从备用子域传送内容?

I am wondering about any "gotchas" - like XSS issues and/or browser issues delivering content from the alternate sub-domain?

推荐答案

Pro:

许多浏览器只会分配两个套接字来从单个主机下载资产.因此,如果从 www.domain.com 下载 index.html 并且它引用了 6 个图像文件、3 个 javascript 文件和 3 个 CSS 文件(都在 www.domain.com 上),则浏览器将一次下载它们 2 个,并且其他阻塞,直到套接字空闲.

Many browsers will only allocate two sockets to downloading assets from a single host. So if index.html is downloaded from www.domain.com and it references 6 image files, 3 javascript files, and 3 CSS files (all on www.domain.com), the browser will download them 2 at a time, with the other blocking until a socket is free.

如果您将 6 个图像文件拉到单独的主机上,例如 images.domain.com,您将获得额外的两个专用于下载图像的套接字.这使资源下载过程并行化,因此理论上,您的页面渲染速度可以提高两倍.

If you pull the 6 image files off onto a separate host, say images.domain.com, you get an extra two sockets dedicated to download your images. This parallelizes the asset download process so, in theory, your page could render twice as fast.

缺点:

如果您使用 SSL,则需要为 images.domain.com 获取额外的单主机 SSL 证书或为 *.domain.com 获取通配符 SSL 证书(匹配任何子域).否则将在浏览器中生成警告,指出该页面包含混合的安全和不安全内容.

If you're using SSL, you would need to either get an additional single-host SSL certificate for images.domain.com or a wildcard SSL certificate for *.domain.com (matches any subdomain). Failure to do so will generate a warning in the browser saying the page contains mixed secure and insecure content.

这篇关于单独的图像服务器(例如images.mydomain.com)的优缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆