使用e-tag来加快页面加载速度和提高用户体验

简介:

 I use the Firefox plugin Tamper Data 10.0.1 to trace the http

If we open the website http://10.242.224.69:8080/estore/ and activate the tamper data plugin.

We can see  that:

 

We can see that If-None-Match=02e81f8533137e20549e917d7122ec ,which means that If the etag equals to this one ,then the server will think that “the client has cached the resource ,so it returns 304

See from the right column . In http protocol : 304 means that



  
  
  1. If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields. 
  2.  
  3. The response MUST include the following header fields: 
  4.  
  5.       - Date, unless its omission is required by section 14.18.1 
  6. If a clockless origin server obeys these rules, and proxies and clients add their own Date to any response received without one (as already specified by [RFC 2068], section 14.19), caches will operate correctly. 
  7.  
  8.       - ETag and/or Content-Location, if the header would have been sent 
  9.         in a 200 response to the same request 
  10.       - Expires, Cache-Control, and/or Vary, if the field-value might 
  11.         differ from that sent in any previous response for the same 
  12.         variant 
  13. If the conditional GET used a strong cache validator (see section 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. 
  14.  
  15. If a 304 response indicates an entity not currently cached, then the cache MUST disregard the response and repeat the request without the conditional. 
  16.  
  17. If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response. 
  18.  
  19.   

So ,since the server returns 304 ,then the server will not contains any response content ,which reduces the bandwidth..  ->see from the right column ,the response is “Not Modified-304”

 

 

That’s why I suggest that we can add e-tag to most elements to accelerate the loading speed and enhance the user experience.





本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/839523,如需转载请自行联系原作者

目录
相关文章
|
6天前
|
人工智能 运维 安全
|
4天前
|
人工智能 异构计算
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
敬请锁定《C位面对面》,洞察通用计算如何在AI时代持续赋能企业创新,助力业务发展!
|
6天前
|
机器学习/深度学习 人工智能 自然语言处理
B站开源IndexTTS2,用极致表现力颠覆听觉体验
在语音合成技术不断演进的背景下,早期版本的IndexTTS虽然在多场景应用中展现出良好的表现,但在情感表达的细腻度与时长控制的精准性方面仍存在提升空间。为了解决这些问题,并进一步推动零样本语音合成在实际场景中的落地能力,B站语音团队对模型架构与训练策略进行了深度优化,推出了全新一代语音合成模型——IndexTTS2 。
565 20
|
12天前
|
人工智能 JavaScript 测试技术
Qwen3-Coder入门教程|10分钟搞定安装配置
Qwen3-Coder 挑战赛简介:无论你是编程小白还是办公达人,都能通过本教程快速上手 Qwen-Code CLI,利用 AI 轻松实现代码编写、文档处理等任务。内容涵盖 API 配置、CLI 安装及多种实用案例,助你提升效率,体验智能编码的乐趣。
923 109
|
5天前
|
人工智能 测试技术 API
智能体(AI Agent)搭建全攻略:从概念到实践的终极指南
在人工智能浪潮中,智能体(AI Agent)正成为变革性技术。它们具备自主决策、环境感知、任务执行等能力,广泛应用于日常任务与商业流程。本文详解智能体概念、架构及七步搭建指南,助你打造专属智能体,迎接智能自动化新时代。