Relaciona método, condición, validador y copia previa. Un 304 confirma la reutilización para esa solicitud; no demuestra indexación ni sustituye la revisión del contenido.
Empieza con la copia que ya existe
Imagina un cliente que descargó una guía y guardó su contenido junto con un ETag. Ese valor identifica una representación para validarla; no debes interpretarlo como una fecha editorial o un contador de visitas. Para investigar una respuesta posterior, conserva también la dirección y la variante solicitada, incluido el idioma.
Este artículo explica un intercambio ficticio de GET. No hemos medido la caché de este sitio ni modificado su configuración. Identificar qué pregunta hace el cliente evita confundir una transferencia reducida con una página que desapareció.
Lee la condición antes del estado
RFC 9110 describe If-None-Match y la respuesta 304 para solicitudes condicionales GET o HEAD. Si el validador coincide según las reglas del protocolo, el servidor puede indicar que se reutilice la representación guardada sin enviar su cuerpo. Si necesita enviar contenido nuevo, puede responder 200 con esa representación.
No fabriques un ETag para forzar el resultado. Conserva el valor recibido, incluidas comillas y cualquier prefijo débil W/. Un código aislado en una hoja de cálculo pierde la condición que ayuda a interpretarlo.
Sigue tres momentos de un ejemplo
La guía y los identificadores siguientes son inventados. Suponemos que el cliente mantiene una copia correcta y que el servidor implementa la validación descrita. La tabla representa alternativas de una conversación, no resultados obtenidos mediante una prueba.
| Momento | Condición enviada | Respuesta ilustrativa |
|---|---|---|
| Primera lectura | Sin copia previa | 200, cuerpo A y ETag "guia-a" |
| Misma representación | If-None-Match: "guia-a" | 304, sin cuerpo; reutilizar A |
| Representación cambiada | If-None-Match: "guia-a" | 200, cuerpo B y ETag "guia-b" |
El tercer caso conserva la condición del cliente anterior; cambia la representación actual del servidor. Así se puede explicar por qué dos solicitudes a la misma dirección no necesitan recibir siempre el mismo estado.
Separa validadores y fechas de publicación
Last-Modified y la condición If-Modified-Since ofrecen otra referencia temporal de HTTP. Esa fecha no equivale automáticamente al día que un editor muestra en el artículo. Si se envían ambas condiciones, RFC 9110 da precedencia a If-None-Match; no sumes sus resultados como dos confirmaciones independientes.
Registra los encabezados efectivamente observados. Si una aplicación cambia traducciones o variantes, revisa qué representación está validando antes de comparar valores entre idiomas. Un validador opaco no explica por sí mismo qué párrafo cambió.
Mantén aparte la pregunta sobre buscadores
Google documenta cómo sus rastreadores interpretan 304 y comunican que el contenido sigue igual que en la visita anterior. Esa interpretación no es una promesa de inclusión en resultados. Tampoco permite identificar como Googlebot a quien escribió un agente en la solicitud.
La guía relacionada de identidad de rastreadores sirve para investigar quién pidió el recurso. El diagnóstico de indexación investiga otra evidencia. No cambies una respuesta a 200 únicamente para que un reporte tenga un color favorable.
Deja una revisión que pueda repetirse
Conserva URL, idioma, método, hora, condición enviada, respuesta, validador y referencia a la copia anterior. Retira cookies, credenciales y datos privados antes de compartir una muestra. Si falta la copia o desconoces qué hizo un intermediario, registra esa limitación.
El cierre útil explica qué se validó y qué quedó pendiente. Una carga visual correcta, una respuesta HTTP y el procesamiento de un buscador son observaciones distintas; usa cada una para contestar su propia pregunta.
HTTP 304 and ETags: understand a response without downloading the page again
A response without a body can be part of a successful read. When a client retains a copy, it can ask whether that copy is still usable before downloading the content again.
Connect method, condition, validator and prior copy. A 304 supports reuse for that request; it establishes neither indexing nor a review of the content.
Start with the existing copy
Imagine a client that downloaded a guide and stored its content with an ETag. That value identifies a representation for validation; do not interpret it as an editorial date or a visit counter. To investigate a later response, also retain the address and requested variant, including language.
This article explains a fictional GET exchange. We have neither measured this site’s cache nor changed its configuration. Identifying the client’s question helps distinguish a smaller transfer from a page that has disappeared.
Read the condition before the status
RFC 9110 describes If-None-Match and 304 for conditional GET or HEAD requests. When the validator matches under the protocol’s rules, the server can indicate reuse of the stored representation without sending its body. When new content needs sending, it can return 200 with that representation.
Do not invent an ETag to force a result. Retain the received value, including quotes and any weak W/ prefix. A status code alone in a spreadsheet loses the condition needed to interpret it.
Follow three moments in an example
The guide and identifiers below are invented. We assume the client retains a correct copy and the server implements the described validation. This table represents alternatives in an exchange, not results from a performed test.
| Moment | Condition sent | Illustrative response |
|---|---|---|
| First read | No previous copy | 200, body A and ETag "guia-a" |
| Same representation | If-None-Match: "guia-a" | 304, no body; reuse A |
| Changed representation | If-None-Match: "guia-a" | 200, body B and ETag "guia-b" |
The third case retains the earlier client condition while the server’s current representation changes. This explains why requests to the same address need not always receive the same status.
Separate validators and publication dates
Last-Modified and If-Modified-Since provide another HTTP time reference. That date does not automatically equal the date an editor displays in an article. If both conditions are sent, RFC 9110 gives If-None-Match precedence; do not add their results as independent confirmations.
Record headers actually observed. Where an application changes translations or variants, check which representation is being validated before comparing values across languages. An opaque validator does not by itself identify a changed paragraph.
Keep the search question separate
Google documents how its crawlers interpret 304 and signal that content remains the same as on the previous visit. That interpretation promises no inclusion in results. It also does not establish Googlebot identity from a declared request agent.
The related crawler identity guide helps investigate who requested a resource. The indexing diagnostic examines different evidence. Do not change a response to 200 simply to give a report a favorable color.
Leave a repeatable review
Retain URL, language, method, time, sent condition, response, validator and a reference to the earlier copy. Remove cookies, credentials and private information before sharing a sample. Record limitations when a copy is missing or an intermediary’s behavior is unknown.
A useful conclusion states what was validated and what remains open. A successful visual load, HTTP response and search processing are different observations; use each for its own question.
HTTP 304 与 ETag:理解无需重新下载页面的响应
没有响应正文,也可能是一次正常读取的一部分。客户端保留副本后,可以先询问该副本是否仍可使用,再决定是否重新下载完整内容。
把方法、条件、验证器与旧副本联系起来。304 支持该次请求复用副本,不能证明索引收录,也不能替代内容复查。
从已有副本开始
假设客户端下载指南后,同时保存内容和 ETag。该值用于识别并验证表示,不能直接理解为编辑日期或访问计数。调查后续响应时,还应保留地址及所请求的版本,包括语言。
本文解释虚构的 GET 交互,没有测量本站缓存,也没有改变配置。明确客户端在问什么,才能区分减少传输与页面消失。
先看条件,再看状态
RFC 9110 说明了条件 GET 或 HEAD 请求中的 If-None-Match 与 304。验证器按照协议规则匹配时,服务器可以指示复用已保存的表示而不发送正文;需要发送新内容时,可以返回 200 及该表示。
不要编造 ETag 来强求结果。保留收到的完整值,包括引号及可能出现的弱验证前缀 W/。电子表格中孤立的状态码,会丢掉解释结果所需的条件。
追踪示例中的三个时刻
以下指南及标识均为虚构。假设客户端保留正确副本,服务器实现了所述验证。表格展示交互中的几种情况,不是已执行测试的结果。
| 时刻 | 发送条件 | 示意响应 |
|---|---|---|
| 首次读取 | 没有旧副本 | 200,正文 A,ETag "guia-a" |
| 表示相同 | If-None-Match: "guia-a" | 304,无正文,复用 A |
| 表示改变 | If-None-Match: "guia-a" | 200,正文 B,ETag "guia-b" |
第三种情况保留客户端旧条件,改变的是服务器当前表示。这能解释为何同一地址的请求不必始终得到相同状态。
区分验证器与发布日期
Last-Modified 与 If-Modified-Since 提供另一种 HTTP 时间参考。它不自动等于编辑在文章上展示的日期。同时发送两种条件时,RFC 9110 规定 If-None-Match 优先,不能把两者当作独立确认相加。
记录实际观察到的响应头。应用涉及译文或不同版本时,先核对正在验证哪种表示,再比较语言之间的值。不透明验证器本身不能说明哪个段落发生变化。
另行处理搜索引擎问题
Google 说明其抓取器如何理解 304,并告知后续处理系统内容与上次访问相同。这不保证出现在搜索结果中,也不能根据请求声明的代理名称确认 Googlebot 身份。
相关抓取器身份指南用于调查谁请求了资源,索引诊断需要其他证据。不要仅为了让报表颜色好看,就把响应改成 200。
留下可复查的记录
保留 URL、语言、方法、时间、发送条件、响应、验证器及旧副本参考。分享样本前,去除 Cookie、凭证和私密信息。缺少副本或不了解中间节点行为时,写明限制。
有用的结论说明验证了什么、还有什么未明。页面视觉加载正常、HTTP 响应及搜索处理是不同观察,应各自回答相应问题。
Fuentes y método
- RFC 9110 · HTTP Semantics, conditional requests and 304 ↗
- Google Crawling Infrastructure · HTTP status codes ↗
- MDN · 304 Not Modified ↗
- MDN · If-Modified-Since ↗
Fuentes consultadas el 1 de noviembre de 2026. Los escenarios y cifras ilustrativos son ficticios. Las fichas y ejercicios son propuestas editoriales originales, sin resultados de clientes ni pruebas de proveedores atribuidos. Editorial standards · Disclosures.