问题原文
原帖链接 · Mike -- No longer here · CC BY-SA 3.0
I tested my site homepage through rigor.com (formerly zoompf.com) and they believe all resources should have an accept-ranges header, but since my HTML code size is under 20 KB (mostly under 10 KB), I somehow feel it is an overkill for the need for that header to be present for the initial HTML page.
I added the header to the images because they are larger than 50 KB and I figure its proper to allow a browser to download parts of the image to complete the download, but for a 20 KB HTML file, I think the need is ridiculous.
Would adding that header make any sort of positive difference even though internet connections now are very fast? or would the header just be an overkill?
已采纳解答
原帖链接 · Yucieyurimoyq · CC BY-SA 3.0
HTML code size is under 20 KB
Since you mention HTML file, there is no need for range headers for HTML files.
For following reasons
- often HTML files are generated by dynamic languages (PHP, JAVA,...) and can change for every single request, so making 2 requests to 'split' the range will result in errors
- HTML files are that small that it makes no sense for range requests.
- Range Requests are recommended for download of big files like MP3s, high res JPGs, ISO,... as they speed up download by splitting big files in chunks which are downloaded at same time.
- For html and assets (images, js, css) it would be an disadvantage for the server to be asked for range requests downloads.
- New technologies like HTTP2 actually do the opposite, they try to combine multiple html assets into ONE request (right after HTML response)
- For all above, you are just increasing header size and wasting your traffic if you add those headers unnecessarily
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
