If-Unmodified-Since

The HTTP If-Unmodified-Since request header is used to transform the HTTP request into one that is conditional based on whether it has remained unmodified since a specific date and time.

Usage

The If-Unmodified-Since request header is included by the client to indicate that the server only completes the HTTP request if the target resource has not been modified since the specified date and time. In the case of unsafe methods such as HTTP PUT, the server will only accept the HTTP request if the condition is met.

A common use of If-Unmodified-Since is to ensure that an HTTP PUT does not overwrite recent updates. Otherwise, this results in the lost update problem. If the resource is more recent than the client has a record of then the server will return the HTTP error message 412 Precondition Failed.

The directives are day-name, day, month, year, hour, minute, second, and GMT.

Note

For a complete description of the directives, please refer to the HTTP Date header.

Example

In this example, the HTTP request will not be fulfilled unless the resource has not been modified since June 1st, 2022, at 8 am GMT.

Request

If-Unmodified-Since: Wed, 01 Jun 2022 08:00:00 GMT

Takeaway

The If-Unmodified-Since header is used to transform the HTTP request into a conditional request, where the resource must be unmodified as of a specific date for the HTTP request to proceed.

See also

Last updated: June 2, 2022