Answer conditional GET with ETag and If-None-Match
Answer: A client can check whether its copy of a page is still current. The server may send an ETag header and a Last-Modified header. The client later sends if-none-match with the last ETag it was sent, or if-modified-since with the last modification time. If the current version of the page matches, the server can send a 304 status code instead of a full response, so the client knows nothing changed.
Django's condition decorator
The condition decorator takes etag_func and last_modified_func. The two functions, to compute the ETag and the last modified time, will be called as the response is prepared. HTTP clients can send headers that tell the server about copies of a resource they already have. | if-none-match | if-modified-since | |---|---| | if-none-match | The last ETag the client was sent | | if-match | An ETag header | | if-modified-since | The date of the last modification time it was sent | | if-unmodified-since | A last modification date |
These headers are optional on HTTP responses.
What Fetch sends
If a stored response's header list contains ETag, then Fetch appends if-none-match with that ETag's value to the request. The Fetch Standard also discusses if-modified-since, if-unmodified-since, if-match, and if-range when it sets cache mode. A status that is 304 is not an ok status in the 200 to 299 range.
See also
Claims
- id: C1 claim: A view can send ETag and Last-Modified headers on a response. source: S1 evidence: "it might provide two HTTP headers: the ETag header"
- id: C3 claim: If the page is unchanged, the server can send a 304 status code. source: S1 evidence: "a 304 status code can be sent back, instead of a full response"
- id: C4 claim: Fetch revalidates a stored response by sending If-None-Match from its ETag. source: S2 evidence: "append (
If-None-Match,ETag's value )"
Sources
- [S1] Conditional View Processing. Django docs. https://docs.djangoproject.com/en/5.2/topics/conditional-view-processing/ . License: BSD-3-Clause. Accessed 2026-11-19.
- [S2] Fetch Standard. WHATWG. https://fetch.spec.whatwg.org/ . License: CC-BY-4.0. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Django docs, Conditional View Processing; WHATWG, Fetch Standard. BSD-3-Clause; CC-BY-4.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Django docs, Conditional View Processing; WHATWG, Fetch Standard. BSD-3-Clause; CC-BY-4.0.
Cite this
iinventedlight. 2026. "Answer conditional GET with ETag and If-None-Match." iinventedlight Library, iil:note:me4wz779, version of 2026-11-19. https://iinventedlight.com/library/notes/http-etag-if-none-match/. License: CC-BY-4.0.
@misc{iil_note_me4wz779,
author = {{iinventedlight}},
title = {{Answer conditional GET with ETag and If-None-Match}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/http-etag-if-none-match/},
note = {Permanent ID iil:note:me4wz779. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- http-etag-if-none-match.table.json (table; CC-BY-4.0)
- http-etag-if-none-match.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/http-etag-if-none-match.md.