当前位置: 动力学知识库 > 问答 > 编程问答 >

http2 - How to host images when using HTTP/2

问题描述:

We are migrating our page to HTTP/2.

When using HTTP/1 there was a limitation of 2 concurrent connections per host. Usually, a technique called sharding was used to work around that.

So content was delivered from www.example.com and the images from img.example.com.

Also, you wouldn't send all the cookies for www.example.com to the image domain, which also saves bandwidth (see What is a cookie free domain).

Things have changed with HTTP/2; what is the best way to serve images using HTTP/2?

  • same domain?
  • different domain?

网友答案:

Short:

No sharding is required, HTTP/2 web servers usually have a liberal connection limit.

As with HTTP/1.1, keep the files as small as possible, HTTP/2 still is bound by the same bandwidth physical constraints.

Multi-plexing is really a plus for concurrent image loading. There are a few demos out there, you can Google them. I can point you to the one that I did:

https://demo1.shimmercat.com/10/

分享给朋友:
您可能感兴趣的文章:
随机阅读: