使用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,如需转载请自行联系原作者

目录
相关文章
【全是精华】Token的获取和使用-FastApi版
【全是精华】Token的获取和使用-FastApi版
1789 0
|
网络虚拟化 虚拟化 Windows
|
7月前
|
机器学习/深度学习 人工智能 监控
翻墙、攀爬、跨越围栏等违规行为检测数据集(10,000 张图片已划分)—安全检测实践
本数据集含10,000张标注图像(9030训练+1130验证),专用于翻墙、攀爬等违规行为检测,支持YOLOv8/v9等模型。含no_climb/climb二分类,YOLO格式标注,覆盖工地、校园、围栏等多场景,光照/角度/遮挡多样,开箱即用,助力智能安防系统快速落地。
|
9月前
|
弹性计算 运维 安全
阿里云服务器镜像怎么选?公共、自定义、共享、云市场、社区镜像区别、适用群体与选择指南
在选择阿里云ECS服务器时,镜像选择至关重要,决定了服务器的初始环境、预装软件及运维复杂度。阿里云提供公共、自定义、共享、云市场和社区五大类镜像。公共镜像适合新手、资深运维及有合规要求的企业;自定义镜像适合中大型企业及需快速复制环境的用户;共享镜像适合团队协作;云市场镜像适合缺乏运维经验的用户;社区镜像适合技术极客及开源爱好者。用户应根据需求、成本、权限、地域及技术支持等因素,选择最适合的镜像。
965 3
|
数据采集 人工智能 JSON
Prompt 工程实战:如何让 AI 生成高质量的 aiohttp 异步爬虫代码
Prompt 工程实战:如何让 AI 生成高质量的 aiohttp 异步爬虫代码
|
7月前
|
安全 算法 物联网
2026 人员定位系统主流技术解析:飞远光电融合方案适配全场景
飞远光电提供室内外多技术融合人员定位系统,集成UWB、蓝牙AOA与北斗,实现厘米级精度与无缝切换。具备实时定位、轨迹回放、电子围栏、SOS求助、智能考勤及数据可视化功能,广泛应用于化工、矿山、工地等高危场景,助力安全管理与运营效率双提升。
613 3
|
8月前
|
机器学习/深度学习 JSON 自然语言处理
PAI-Rec 特征工程全解析:统计特征、实时特征、序列特征与 FG 特征算子
PAI-Rec是阿里云智能推荐的特征工程解决方案,支持离线统计、实时及序列特征自动衍生,并通过Feature Generator(17种内置算子)保障离线/在线特征一致性,大幅降低开发与维护成本。
933 9
|
存储 C++ Java
C++ 指针详解:从入门到理解内存的本质
指针是C++中高效操作内存的核心工具,掌握它等于掌握程序底层运行机制。本文系统讲解指针基础、数组关联、动态内存管理及常见陷阱,助你避开“悬空”“野指针”等雷区,善用智能指针,真正实现“指”掌全局。#C++指针入门
879 156
|
Java Maven
apache-maven-3.9.9-bin.zip 使用步骤(超简单版)
下载Maven安装包并解压,配置MAVEN_HOME环境变量及Path路径,通过cmd输入mvn -v验证安装成功。建议修改本地仓库路径至非C盘,最后在IDEA中设置Maven路径以集成使用,完成开发环境配置。
3103 4