A conditional request asks the server to act only if a condition holds. For caching, the client sends a validator it saved earlier, and the server compares it with the current version. If nothing changed, it replies with a tiny 304 response and no body.
Why it matters
Revalidating is far cheaper than redownloading. A 300 KB script that has not changed costs a few hundred bytes of headers instead of the full file, and the user's browser can reuse its local copy. It keeps content fresh without giving up most of the bandwidth savings.
Example
First response from the server:
HTTP/1.1 200 OK
ETag: "33a64df5"
Last-Modified: Wed, 07 Oct 2026 10:00:00 GMT
Cache-Control: max-age=0, must-revalidate
Later request from the browser:
GET /style.css HTTP/1.1
If-None-Match: "33a64df5"
If-Modified-Since: Wed, 07 Oct 2026 10:00:00 GMT
If unchanged, the server answers 304 Not Modified. Conditional headers also protect writes: If-Match on a PUT avoids overwriting someone else's edit, returning 412 when the version differs.
Common mistakes
- Generating different ETags on each server in a cluster, so revalidation always fails.
- Sending a 200 with the full body when the validator matches.
- Forgetting that a 304 must still include the cache headers the browser should apply.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.