← All notes

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

Sources

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

Permanent ID: iil:note:me4wz779

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.},
}

Markdown

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.

All artifact files (JSON index)

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.