大网数据广告活动
网站运营与故障问答

Is it an overkill to specify the accept-ranges header for small HTML pages?

· 52CE 我爱测

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 overki…

问题原文

原帖链接 · 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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。