If-None-Match 是一个 HTTP 请求头(request header),用于发起条件请求:客户端把先前收到的资源标识符 ETag 发回给服务器,询问“如果资源的 ETag 没变,就不要再传内容”。
常见结果:若资源未变化,服务器返回 304 Not Modified,节省带宽与加快加载。(它也可用于某些写请求的并发控制场景,但最常见用途是缓存验证。)
/ɪf nʌn mætʃ/
The browser sends an If-None-Match header to check whether the cached file is still valid.
浏览器会发送 If-None-Match 请求头,用来检查缓存的文件是否仍然有效。
If the server sees the same ETag in If-None-Match, it may reply with 304 Not Modified instead of sending the full response body.
如果服务器在 If-None-Match 中看到相同的 ETag,就可能返回 304 Not Modified,而不是发送完整的响应内容。
该术语来自 HTTP 规范中的条件语义:if 表示“如果”,none 表示“没有/不”,match 表示“匹配”。合起来表达“如果没有匹配(即不匹配某个 ETag)时才返回内容”,用于让客户端在资源未变更时避免重复下载。