What are conditional requests, and how do Last-Modified and If-Modified-Since headers work together?

Last updated 29 June 2026

  • Conditional requests let a client act only if a resource changed (or didn't), saving bandwidth and avoiding lost updates.

  • The server sends a Last-Modified timestamp. The client echoes it in If-Modified-Since, and gets 304 Not Modified (no body) if unchanged or 200 OK with the new body if changed.

  • ETag/If-None-Match is more precise (content hash, not timestamp) and If-Match enables optimistic concurrency on writes.

  • https://www.youtube.com/watch?v=umBMs-m0JMw
  • https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_rest_conditional_requests.htm
  • https://zuplo.com/learning-center/optimizing-rest-apis-with-conditional-requests-and-etags
  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Conditional_requests
All REST API interview questions