Meridian Web Reference
Technical notes / Open reference
Contents ▾
GUIDE / HTTP REFERENCE

Conditional requests and the 304 response.

Conditional requests let a client ask whether an existing representation remains usable without downloading it again.

Editorial team ·

Start with a stored response

A client can keep a representation along with a validator such as an ETag or Last-Modified value. On a later request, it sends a corresponding conditional header. The server evaluates that condition against the selected representation. If the representation has not changed under the relevant validator, a conditional GET can receive 304 Not Modified without a response body. A 304 makes no sense as a general replacement for a first successful GET.

Understand validator strength

An ETag is an opaque identifier chosen by the server for a representation. A weak ETag is marked with W/ and does not promise byte-for-byte equality; it may still support cache revalidation. Last-Modified is limited by timestamp granularity and accurate modification tracking. When If-None-Match is present, it takes precedence over If-Modified-Since for the relevant request. Clients should not interpret the ETag string as a timestamp or file checksum unless that is explicitly their own private contract.

Read the 304 metadata

A 304 response may update stored response metadata such as cache directives or validators. It has no message body, even if the server sends headers that describe the selected representation. A tool showing an empty output after 304 has not necessarily encountered an error. Inspect the request conditions and the cached object before declaring success or failure. If the resource has changed, an ordinary 200 response with the new representation is the expected path.

Verify with a controlled sequence

Fetch a public test resource, retain its validator and repeat with If-None-Match. Change the resource in a controlled environment and repeat again. The second request should reflect the unchanged representation; the later request should deliver the updated content. Keep intermediate caches in mind because an intermediary can answer independently when permitted. Use the caching guide for freshness policy, which is related to validation but is not the same decision.

Keep reading

Continue with the start here index, or explore the overview for the wider context. To explore the behaviour, send a request to a controlled test server and record both its conditions and the response. Compare the result with the rule described above. An illustrative HTTP exchange should never be presented as a measurement of a remote service.